forked from engineering/cloudservices
rm cname dns record POST
parent
458b7c9788
commit
a28fbc5f34
|
@ -130,9 +130,9 @@ export default class CWG_Create extends Command {
|
||||||
|
|
||||||
return Promise.all(completed);
|
return Promise.all(completed);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
this.client.util.handleError(err, message, this);
|
||||||
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] })];
|
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 Promise.allSettled(tasks);
|
||||||
return this.client.util.handleError(err, message, this);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -172,15 +172,6 @@ export default class CWG_Create extends Command {
|
||||||
x509,
|
x509,
|
||||||
enabled: true,
|
enabled: true,
|
||||||
});
|
});
|
||||||
if (domain.includes('cloud.libraryofcode.org')) {
|
|
||||||
const dmn = domain.split('.');
|
|
||||||
await axios({
|
|
||||||
method: 'post',
|
|
||||||
url: 'https://api.cloudflare.com/client/v4/zones/5e82fc3111ed4fbf9f58caa34f7553a7/dns_records',
|
|
||||||
headers: { Authorization: `Bearer ${this.client.config.cloudflare}`, 'Content-Type': 'application/json' },
|
|
||||||
data: JSON.stringify({ type: 'CNAME', name: `${dmn[0]}.${dmn[1]}`, content: 'cloud.libraryofcode.org', proxied: false }),
|
|
||||||
});
|
|
||||||
}
|
|
||||||
return entry.save();
|
return entry.save();
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
const tasks = [fs.unlink(`/etc/nginx/sites-enabled/${domain}`), fs.unlink(`/etc/nginx/sites-available/${domain}`), 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 })];
|
||||||
|
|
Loading…
Reference in New Issue