Skip to content

Commit

Permalink
chore: update mongodb envs
Browse files Browse the repository at this point in the history
  • Loading branch information
xuriwuyun committed Aug 15, 2024
1 parent 254df15 commit 6ba4d15
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions engines/mongodb/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,10 @@ const (
params = "params"
adminDatabase = "admin"

defaultTimeout = 5 * time.Second
defaultDBPort = 27017
defaultTimeout = 5 * time.Second
defaultDBPort = 27017
RootUserEnv = "MONGODB_USER"
RootPasswordEnv = "MONGODB_PASSWORD"
)

type Config struct {
Expand Down Expand Up @@ -87,10 +89,15 @@ func NewConfig(properties map[string]string) (*Config, error) {

if viper.IsSet(constant.KBEnvServiceUser) {
config.Username = viper.GetString(constant.KBEnvServiceUser)
} else if viper.IsSet(RootUserEnv) {
config.Username = viper.GetString(RootUserEnv)

}

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

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

0 comments on commit 6ba4d15

Please sign in to comment.