feat: add initial root access token (#1598)
Signed-off-by: xiaobo <peterwillcn@gmail.com>
This commit is contained in:
parent
46a0773580
commit
6a941748f8
@ -143,6 +143,8 @@ var MetricFailChanSize = env.Int("METRIC_FAIL_CHAN_SIZE", 128)
|
||||
|
||||
var InitialRootToken = os.Getenv("INITIAL_ROOT_TOKEN")
|
||||
|
||||
var InitialRootAccessToken = os.Getenv("INITIAL_ROOT_ACCESS_TOKEN")
|
||||
|
||||
var GeminiVersion = env.String("GEMINI_VERSION", "v1")
|
||||
|
||||
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user