@@ -128,7 +128,10 @@ func (opt *postgresOptions) waitForDBReady(appBinding *v1alpha1.AppBinding, secr
128
128
if err != nil {
129
129
return err
130
130
}
131
- shell .SetEnv (EnvPGSSLMODE , pgSSlmode )
131
+ // Only set "PGSSLMODE" mode env variable, if it has been provided in the AppBinding.
132
+ if pgSSlmode != "" {
133
+ shell .SetEnv (EnvPGSSLMODE , pgSSlmode )
134
+ }
132
135
133
136
//shell.SetEnv(EnvPgPassword, must(meta_util.GetBytesForKeys(secret.Data, core.BasicAuthPasswordKey, envPostgresPassword)))
134
137
args := []interface {}{
@@ -142,8 +145,10 @@ func (opt *postgresOptions) waitForDBReady(appBinding *v1alpha1.AppBinding, secr
142
145
}
143
146
144
147
func getSSLMODE (appBinding * v1alpha1.AppBinding ) (string , error ) {
145
-
146
148
sslmodeString := appBinding .Spec .ClientConfig .Service .Query
149
+ if sslmodeString == "" {
150
+ return "" , nil
151
+ }
147
152
temps := strings .Split (sslmodeString , "=" )
148
153
if len (temps ) != 2 {
149
154
return "" , fmt .Errorf ("the sslmode is not valid. please provide the valid template. the temlpate should be like this: sslmode=<your_desire_sslmode>" )
@@ -198,6 +203,9 @@ func (opt *postgresOptions) GetResticWrapperWithPGConnectorVariables(appBinding
198
203
if err != nil {
199
204
return nil , userName , err
200
205
}
201
- resticWrapper .SetEnv (EnvPGSSLMODE , pgSSlmode )
206
+ // Only set "PGSSLMODE" mode env variable, if it has been provided in the AppBinding.
207
+ if pgSSlmode != "" {
208
+ resticWrapper .SetEnv (EnvPGSSLMODE , pgSSlmode )
209
+ }
202
210
return resticWrapper , userName , nil
203
211
}
0 commit comments