Refactor ldap envs

main
radex 2023-10-23 20:36:14 +02:00
parent 481b9480d5
commit 40753b018f
2 changed files with 3 additions and 12 deletions

View File

@ -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;
}

View File

@ -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;
}