refactor: apply @openstapps/eslint-config rules

This commit is contained in:
Rainer Killinger
2022-05-09 11:14:36 +02:00
parent 1fcf7340d4
commit ac144095bf
8 changed files with 1264 additions and 231 deletions

View File

@@ -20,8 +20,10 @@ import {render} from 'mustache';
import {asyncReadFile, asyncWriteFile} from './common';
import {getContainers, getTemplateView} from './main';
/* eslint-disable unicorn/prefer-module */
// handle unhandled promise rejections
process.on('unhandledRejection', async (error) => {
process.on('unhandledRejection', async error => {
await Logger.error(error);
process.exit(1);
});
@@ -42,6 +44,7 @@ async function updateNginxConfig() {
.join(',');
delete require.cache[require.resolve('config')];
// eslint-disable-next-line @typescript-eslint/no-var-requires
const configFile = require('config');
const configHash = JSON.stringify(configFile);
@@ -50,7 +53,10 @@ async function updateNginxConfig() {
Logger.log('Generating new NGINX configuration');
// render nginx config file
const nginxConfig = render(await asyncReadFile('nginx.conf.template', 'utf8'), await getTemplateView(containers));
const nginxConfig = render(
await asyncReadFile('nginx.conf.template', 'utf8'),
await getTemplateView(containers),
);
containerHashCache = containerHash;
configHashCache = configHash;
@@ -65,9 +71,9 @@ async function updateNginxConfig() {
execSync('nginx -s reload');
}
// tslint:disable-next-line:no-magic-numbers - set timeout to update configuration again in 30s
setTimeout(updateNginxConfig, 30000);
// set timeout to update configuration again in 30s
setTimeout(updateNginxConfig, 30_000);
}
// tslint:disable-next-line:no-floating-promises - start the process that checks the docker socket periodically
// start the process that checks the docker socket periodically
updateNginxConfig();