Refactor ldap envs
parent
481b9480d5
commit
40753b018f
|
@ -14,10 +14,7 @@ export class LdapHydrationService implements IHydrationService {
|
|||
},
|
||||
strictDN: false
|
||||
});
|
||||
await client.bind(
|
||||
`cn=${env.SERVICE_USER_NAME},ou=Services,dc=hackerspace,dc=pl`,
|
||||
env.SERVICE_USER_PASSWORD
|
||||
);
|
||||
await client.bind(env.LDAP_USER_DN, env.LDAP_USER_PW);
|
||||
return client;
|
||||
}
|
||||
|
||||
|
|
|
@ -15,14 +15,8 @@ export async function load({ route, locals }) {
|
|||
|
||||
let ldap = true;
|
||||
try {
|
||||
invariant(
|
||||
env.SERVICE_USER_NAME,
|
||||
'SERVICE_USER_NAME is not defined, reverting to fake hydration'
|
||||
);
|
||||
invariant(
|
||||
env.SERVICE_USER_PASSWORD,
|
||||
'SERVICE_USER_PASSWORD is not defined, reverting to fake hydration'
|
||||
);
|
||||
invariant(env.LDAP_USER_DN, 'LDAP_USER_DN is not defined, reverting to fake hydration');
|
||||
invariant(env.LDAP_USER_PW, 'LDAP_USER_PW is not defined, reverting to fake hydration');
|
||||
} catch (e) {
|
||||
ldap = false;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue