symlink cloud certs instead of writing
parent
7e20b362c3
commit
8e9b260481
|
@ -1,4 +1,4 @@
|
|||
import fs, { writeFile, unlink } from 'fs-extra';
|
||||
import fs, { writeFile, unlink, symlink } from 'fs-extra';
|
||||
import axios from 'axios';
|
||||
import { randomBytes } from 'crypto';
|
||||
import { Message, MessageEmbed, TextChannel } from 'discord.js';
|
||||
|
@ -190,7 +190,11 @@ export default class CWG_Create extends Command {
|
|||
throw new Error('Certificate and Private Key do not match');
|
||||
}
|
||||
|
||||
await Promise.all([writeFile(`/etc/ssl/certs/cwg/${domain}.chain.crt`, certChain), writeFile(`/etc/ssl/private/cwg/${domain}.key.pem`, privateKey)]);
|
||||
if (domain.endsWith('.cloud.libraryofcode.org')) {
|
||||
await Promise.all([symlink('/etc/ssl/private/cloud-libraryofcode-org.chain.crt', `/etc/ssl/certs/cwg/${domain}.chain.crt`), symlink('/etc/ssl/private/cloud-libraryofcode-org.key', `/etc/ssl/private/cwg/${domain}.key.pem`)]);
|
||||
} else {
|
||||
await Promise.all([writeFile(`/etc/ssl/certs/cwg/${domain}.chain.crt`, certChain), writeFile(`/etc/ssl/private/cwg/${domain}.key.pem`, privateKey)]);
|
||||
}
|
||||
return { cert: `/etc/ssl/certs/cwg/${domain}.chain.crt`, key: `/etc/ssl/private/cwg/${domain}.key.pem` };
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue