1
0
Fork 0

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

refactor/models
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); return Promise.all(completed);
} catch (err) { } catch (err) {
await fs.unlink(`/etc/nginx/sites-available/${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 fs.unlink(`/etc/nginx/sites-enabled/${args[1]}`); await Promise.allSettled(tasks);
await this.client.db.Domain.deleteMany({ domain: args[1] });
return this.client.util.handleError(err, message, this); 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', 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(/\[DOMAIN]/g, domain);
cfg = cfg.replace(/\[PORT]/g, String(port)); cfg = cfg.replace(/\[PORT]/g, String(port));
cfg = cfg.replace(/\[CERTIFICATE]/g, x509.cert); cfg = cfg.replace(/\[CERTIFICATE]/g, x509.cert);
@ -180,9 +179,8 @@ export default class CWG_Create extends Command {
} }
return entry.save(); return entry.save();
} catch (error) { } catch (error) {
await fs.unlink(`/etc/nginx/sites-enabled/${domain}`); const tasks = [fs.unlink(`/etc/nginx/sites-enabled/${domain}`), fs.unlink(`/etc/nginx/sites-available/${domain}`), this.client.db.Domain.deleteMany({ domain })];
await fs.unlink(`/etc/nginx/sites-available/${domain}`); await Promise.allSettled(tasks);
await this.client.db.Domain.deleteMany({ domain });
throw error; throw error;
} }
} }

View File

@ -2,7 +2,7 @@
"compilerOptions": { "compilerOptions": {
/* Basic Options */ /* Basic Options */
// "incremental": true, /* Enable incremental compilation */ // "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'. */ "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. */ "lib": ["ES2019.Object", "ES2020.Promise"], /* Specify library files to be included in the compilation. */
// "allowJs": true, /* Allow javascript files to be compiled. */ // "allowJs": true, /* Allow javascript files to be compiled. */