Merge branch 'master' of gitlab.libraryofcode.org:engineering/cloudservices

merge-requests/4/head
Matthew 2020-03-29 18:12:48 -04:00
commit b52eb6218a
No known key found for this signature in database
GPG Key ID: 766BE43AE75F7559
2 changed files with 6 additions and 8 deletions

View File

@ -126,9 +126,8 @@ export default class CWG_Create extends Command {
return Promise.all(completed);
} catch (err) {
await fs.unlink(`/etc/nginx/sites-available/${args[1]}`);
await fs.unlink(`/etc/nginx/sites-enabled/${args[1]}`);
await this.client.db.Domain.deleteMany({ domain: args[1] });
const tasks = [fs.unlink(`/etc/nginx/sites-enabled/${args[1]}`), fs.unlink(`/etc/nginx/sites-available/${args[1]}`), this.client.db.Domain.deleteMany({ domain: args[1] })];
await Promise.allSettled(tasks);
return this.client.util.handleError(err, message, this);
}
}
@ -155,7 +154,7 @@ export default class CWG_Create extends Command {
key: '/etc/ssl/private/cloud-libraryofcode-org.key',
};
}
let cfg = await fs.readFile('/opt/CloudServices/dist/static/nginx.conf', { encoding: 'utf8' });
let cfg = await fs.readFile('/opt/CloudServices/src/static/nginx.conf', { encoding: 'utf8' });
cfg = cfg.replace(/\[DOMAIN]/g, domain);
cfg = cfg.replace(/\[PORT]/g, String(port));
cfg = cfg.replace(/\[CERTIFICATE]/g, x509.cert);
@ -180,9 +179,8 @@ export default class CWG_Create extends Command {
}
return entry.save();
} catch (error) {
await fs.unlink(`/etc/nginx/sites-enabled/${domain}`);
await fs.unlink(`/etc/nginx/sites-available/${domain}`);
await this.client.db.Domain.deleteMany({ domain });
const tasks = [fs.unlink(`/etc/nginx/sites-enabled/${domain}`), fs.unlink(`/etc/nginx/sites-available/${domain}`), this.client.db.Domain.deleteMany({ domain })];
await Promise.allSettled(tasks);
throw error;
}
}

View File

@ -2,7 +2,7 @@
"compilerOptions": {
/* Basic Options */
// "incremental": true, /* Enable incremental compilation */
"target": "ES2017", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. */
"target": "ES2020", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. */
"module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */
"lib": ["ES2019.Object", "ES2020.Promise"], /* Specify library files to be included in the compilation. */
// "allowJs": true, /* Allow javascript files to be compiled. */