diff --git a/src/commands/cwg_create.ts b/src/commands/cwg_create.ts index 8a5a8a1..33d009f 100644 --- a/src/commands/cwg_create.ts +++ b/src/commands/cwg_create.ts @@ -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; } } diff --git a/tsconfig.json b/tsconfig.json index febdc18..10493bf 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -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. */