Make tests pass
This commit is contained in:
+10
-3
@@ -78,7 +78,12 @@ async function applyConfig(config) {
|
||||
const [error] = await safe(shell.promises.sudo('setLdapAllowlist', [ SET_LDAP_ALLOWLIST_CMD ], {}));
|
||||
if (error) throw new BoxError(BoxError.IPTABLES_ERROR, `Error setting ldap allowlist: ${error.message}`);
|
||||
|
||||
if (config.enabled) await start(); else await stop();
|
||||
if (!config.enabled) {
|
||||
await stop();
|
||||
return;
|
||||
}
|
||||
|
||||
if (!gServer) await start();
|
||||
}
|
||||
|
||||
async function setConfig(directoryServerConfig) {
|
||||
@@ -320,7 +325,7 @@ async function userAuth(req, res, next) {
|
||||
}
|
||||
|
||||
async function start() {
|
||||
if (gServer) return; // already running
|
||||
assert(gServer === null, 'Already running');
|
||||
|
||||
const logger = {
|
||||
trace: NOOP,
|
||||
@@ -386,11 +391,13 @@ async function stop() {
|
||||
|
||||
debug('stopping server');
|
||||
|
||||
gServer.close();
|
||||
await util.promisify(gServer.close.bind(gServer))();
|
||||
gServer = null;
|
||||
}
|
||||
|
||||
async function checkCertificate() {
|
||||
assert(gServer !== null, 'Directory server is not running');
|
||||
|
||||
const certificate = await reverseProxy.getDirectoryServerCertificate();
|
||||
if (certificate.cert === gCertificate.cert) {
|
||||
debug('checkCertificate: certificate has not changed');
|
||||
|
||||
Reference in New Issue
Block a user