Skip to content

Commit

Permalink
chore: update mysql envs
Browse files Browse the repository at this point in the history
  • Loading branch information
xuriwuyun committed Aug 16, 2024
1 parent 4577b4b commit 111e087
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions engines/mysql/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ const (
const (
adminDatabase = "mysql"
defaultDBPort = 3306
EnvRootUser = "MYSQL_ROOT_USER"
EnvRootPass = "MYSQL_ROOT_PASSWORD"
)

type Config struct {
Expand Down Expand Up @@ -88,12 +90,16 @@ func NewConfig(properties map[string]string) (*Config, error) {

if viper.IsSet(constant.KBEnvServiceUser) {
config.Username = viper.GetString(constant.KBEnvServiceUser)
} else if viper.IsSet(EnvRootUser) {
config.Username = viper.GetString(EnvRootUser)
} else if username, ok := properties["username"]; ok {
config.Username = username
}

if viper.IsSet(constant.KBEnvServicePassword) {
config.Password = viper.GetString(constant.KBEnvServicePassword)
} else if viper.IsSet(EnvRootPass) {
config.Password = viper.GetString(EnvRootPass)
}

if viper.IsSet(constant.KBEnvServicePort) {
Expand Down

0 comments on commit 111e087

Please sign in to comment.