From e07211d0f8d1ccc8d3640407a2df660ae64709de Mon Sep 17 00:00:00 2001 From: Bsian Date: Sun, 29 Mar 2020 22:40:50 +0100 Subject: [PATCH] Bug fixes --- src/commands/cwg_create.ts | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/commands/cwg_create.ts b/src/commands/cwg_create.ts index 8a5a8a1..2d8937e 100644 --- a/src/commands/cwg_create.ts +++ b/src/commands/cwg_create.ts @@ -155,7 +155,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 +180,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; } }