Skip to content

Commit 104c4f3

Browse files
authored
Fix TLS for ClientAuthMode MD5 (#1312) (#1315)
Signed-off-by: souravbiswassanto <[email protected]>
1 parent 0fbdd5c commit 104c4f3

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

pkg/util.go

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,9 @@ func (opt *postgresOptions) setDatabaseCredentials(appBinding *appcatalog.AppBin
113113
return err
114114
}
115115

116-
userName := ""
116+
userName := must(meta_util.GetBytesForKeys(appBindingSecret.Data, core.BasicAuthUsernameKey, envPostgresUser))
117+
session.sh.SetEnv(EnvPgPassword, must(meta_util.GetBytesForKeys(appBindingSecret.Data, core.BasicAuthPasswordKey, envPostgresPassword)))
118+
117119
if appBinding.Spec.TLSSecret != nil && appBinding.Spec.TLSSecret.Name != "" {
118120
appBindingSecret, err = opt.kubeClient.CoreV1().Secrets(appBinding.Namespace).Get(context.TODO(), appBinding.Spec.TLSSecret.Name, metav1.GetOptions{})
119121
if err != nil {
@@ -138,14 +140,10 @@ func (opt *postgresOptions) setDatabaseCredentials(appBinding *appcatalog.AppBin
138140
}
139141
session.sh.SetEnv(EnvPGSSLKEY, filepath.Join(opt.setupOptions.ScratchDir, core.TLSPrivateKeyKey))
140142

141-
// TODO: this one is hard coded here but need to change later
142-
userName = opt.user
143-
} else {
144-
// set env for pg_dump/pg_dumpall
145-
session.sh.SetEnv(EnvPgPassword, must(meta_util.GetBytesForKeys(appBindingSecret.Data, core.BasicAuthPasswordKey, envPostgresPassword)))
146-
userName = must(meta_util.GetBytesForKeys(appBindingSecret.Data, core.BasicAuthUsernameKey, envPostgresUser))
143+
if opt.user != "" {
144+
userName = opt.user
145+
}
147146
}
148-
149147
pgSSlmode, err := getSSLMODE(appBinding)
150148
if err != nil {
151149
return err

0 commit comments

Comments
 (0)