Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ZMS-139 #659

Merged
merged 2 commits into from
Apr 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 13 additions & 1 deletion api.js
Expand Up @@ -581,7 +581,18 @@ module.exports = done => {
);
}

server.pre(restifyApiGenerate.restifyApiGenerate(server, restifyApiGenerateConfig));
if (process.env.GENERATE_API_DOCS === 'true') {
server.pre(restifyApiGenerate.restifyApiGenerate(server, restifyApiGenerateConfig));
}

if (process.env.REGENERATE_API_DOCS === 'true') {
// allow 2.5 seconds for services to start and the api doc to be generated, after that exit process
(async function () {
const sleep = ms => new Promise(resolve => setTimeout(resolve, ms));
await sleep(2500);
process.exit(0);
})();
}

server.on('error', err => {
if (!started) {
Expand All @@ -605,6 +616,7 @@ module.exports = done => {
}
started = true;
log.info('API', 'Server listening on %s:%s', config.api.host || '0.0.0.0', config.api.port);

done(null, server);
});
};
3 changes: 2 additions & 1 deletion package.json
Expand Up @@ -12,7 +12,8 @@
"apidoc": "apidoc -i lib/api/ -o docs/api/",
"show": "NODE_CONFIG_ONLY=true node server.js",
"start": "node server.js",
"update": "rm -rf node_modules package-lock.json && ncu -u && npm install"
"update": "rm -rf node_modules package-lock.json && ncu -u && npm install",
"generate-api-docs": "GENERATE_API_DOCS=true REGENERATE_API_DOCS=true node server.js"
},
"keywords": [
"imap",
Expand Down