Skip to content

Commit

Permalink
chore: update pg envs
Browse files Browse the repository at this point in the history
  • Loading branch information
xuriwuyun committed Aug 16, 2024
1 parent 111e087 commit 287b13b
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions engines/postgres/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ import (
const (
ConnectionURLKey = "url"
DefaultPort = 5432
EnvRootUser = "POSTGRES_USER"
EnvRootPass = "POSTGRES_PASSWORD"
)

type Config struct {
Expand Down Expand Up @@ -72,9 +74,14 @@ 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)
}

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

config.URL = config.GetConnectURLWithHost(config.Host)
Expand Down

0 comments on commit 287b13b

Please sign in to comment.