Skip to content

Commit b68426d

Browse files
committed
Move secret loading to only run once
1 parent b90f95a commit b68426d

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

internal/service/ldap_service.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,10 @@ func NewLdapService(
6262
*/
6363
}
6464

65+
secret := utils.GetSecret(config.LDAP.BindPassword, config.LDAP.BindPasswordFile)
66+
config.LDAP.BindPassword = secret
67+
config.LDAP.BindPasswordFile = ""
68+
6569
_, err := ldap.connect()
6670

6771
if err != nil {
@@ -213,9 +217,6 @@ func (ldap *LdapService) BindService(rebind bool) error {
213217
if ldap.cert != nil {
214218
return ldap.conn.ExternalBind()
215219
}
216-
secret := utils.GetSecret(ldap.config.LDAP.BindPassword, ldap.config.LDAP.BindPasswordFile)
217-
ldap.config.LDAP.BindPassword = secret
218-
ldap.config.LDAP.BindPasswordFile = ""
219220
return ldap.conn.Bind(ldap.config.LDAP.BindDN, ldap.config.LDAP.BindPassword)
220221
}
221222

0 commit comments

Comments
 (0)