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; } }