Bug fixes

merge-requests/4/head
Bsian 2020-03-29 22:40:50 +01:00
parent 677e09df9e
commit e07211d0f8
No known key found for this signature in database
GPG Key ID: 097FB9A291026091
1 changed files with 3 additions and 4 deletions

View File

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