File tree Expand file tree Collapse file tree 1 file changed +8
-7
lines changed
Expand file tree Collapse file tree 1 file changed +8
-7
lines changed Original file line number Diff line number Diff line change @@ -49,8 +49,8 @@ func ParseServerConfigFromFile(filePath string) *ServerConfig {
4949 panic (err )
5050 }
5151
52- if config .DBConfig .Password == "" { // read password from AWS secret
53- config .DBConfig .Password = GetDBPass (config .DBConfig )
52+ if config .DBConfig .Username == "" || config . DBConfig . Password == "" { // read password from AWS secret
53+ config .DBConfig .Username , config . DBConfig . Password = GetDBUsernamePassword (config .DBConfig )
5454 }
5555
5656 return & config
@@ -87,25 +87,26 @@ func ParseMonitorConfigFromFile(filePath string) *MonitorConfig {
8787 panic (err )
8888 }
8989
90- if config .DBConfig .Password == "" { // read password from AWS secret
91- config .DBConfig .Password = GetDBPass (config .DBConfig )
90+ if config .DBConfig .Username == "" || config . DBConfig . Password == "" { // read password from AWS secret
91+ config .DBConfig .Username , config . DBConfig . Password = GetDBUsernamePassword (config .DBConfig )
9292 }
9393
9494 return & config
9595}
9696
97- func GetDBPass (cfg * DBConfig ) string {
97+ func GetDBUsernamePassword (cfg * DBConfig ) ( string , string ) {
9898 result , err := GetSecret (cfg .AWSSecretName , cfg .AWSRegion )
9999 if err != nil {
100100 panic (err )
101101 }
102102 type DBPass struct {
103- DbPass string `json:"db_pass"`
103+ Username string `json:"username"`
104+ Password string `json:"password"`
104105 }
105106 var dbPassword DBPass
106107 err = json .Unmarshal ([]byte (result ), & dbPassword )
107108 if err != nil {
108109 panic (err )
109110 }
110- return dbPassword .DbPass
111+ return dbPassword .Username , dbPassword . Password
111112}
You can’t perform that action at this time.
0 commit comments