diff --git a/src/commands/cwg_create.ts b/src/commands/cwg_create.ts index a3120c4..8029320 100644 --- a/src/commands/cwg_create.ts +++ b/src/commands/cwg_create.ts @@ -47,7 +47,7 @@ export default class CWG_Create extends Command { try { answer = await this.client.util.messageCollector( message, - `***${this.client.stores.emojis.error} ***This port is already binded to a domain. Do you wish to continue? (y/n)***`, + `***${this.client.stores.emojis.error} This port is already binded to a domain. Do you wish to continue? (y/n)***`, 30000, true, ['y', 'n'], (msg) => msg.author.id === message.author.id && msg.channel.id === message.channel.id, ); } catch (error) { @@ -189,16 +189,13 @@ export default class CWG_Create extends Command { if (!this.isValidCertificateChain(certChain)) throw new Error('Invalid Certificate Chain'); if (!this.isValidPrivateKey(privateKey)) throw new Error('Invalid Private Key'); const path = `/opt/CloudServices/temp/${domain}`; - const temp = [writeFile(`${path}.chain.crt`, certChain), writeFile(`${path}.key.pem`, privateKey)]; - const removeFiles = [unlink(`${path}.chain.crt`), unlink(`${path}.key.pem`)]; - await Promise.all(temp); + await Promise.all([writeFile(`${path}.chain.crt`, certChain), writeFile(`${path}.key.pem`, privateKey)]); if (!this.isMatchingPair(`${path}.chain.crt`, `${path}.key.pem`)) { - await Promise.all(removeFiles); + await Promise.all([unlink(`${path}.chain.crt`), unlink(`${path}.key.pem`)]); throw new Error('Certificate and Private Key do not match'); } - const tasks = [writeFile(`/etc/nginx/ssl/${domain}.chain.crt`, certChain), writeFile(`/etc/nginx/ssl/${domain}.key.pem`, privateKey)]; - await Promise.all(tasks); + await Promise.all([writeFile(`/etc/ssl/certs/cwg/${domain}.chain.crt`, certChain), writeFile(`/etc/certs/private/cwg/${domain}.key.pem`, privateKey)]); return { cert: `/etc/nginx/ssl/${domain}.chain.crt`, key: `/etc/nginx/ssl/${domain}.key.pem` }; }