mirror of
https://github.com/songquanpeng/one-api.git
synced 2025-10-14 23:00:27 +00:00
feat: add initial root access token (#1598)
Signed-off-by: xiaobo <peterwillcn@gmail.com>
This commit is contained in:
@@ -30,13 +30,17 @@ func CreateRootAccountIfNeed() error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
accessToken := random.GetUUID()
|
||||
if config.InitialRootAccessToken != "" {
|
||||
accessToken = config.InitialRootAccessToken
|
||||
}
|
||||
rootUser := User{
|
||||
Username: "root",
|
||||
Password: hashedPassword,
|
||||
Role: RoleRootUser,
|
||||
Status: UserStatusEnabled,
|
||||
DisplayName: "Root User",
|
||||
AccessToken: random.GetUUID(),
|
||||
AccessToken: accessToken,
|
||||
Quota: 500000000000000,
|
||||
}
|
||||
DB.Create(&rootUser)
|
||||
|
Reference in New Issue
Block a user