From b7b588d71351e0961bbbdeddc90c5061e0faaa89 Mon Sep 17 00:00:00 2001 From: Phil Kunz Date: Wed, 9 Jan 2019 14:10:57 +0100 Subject: [PATCH] fix(core): update --- test/test.ts | 1 - ts/smartnginx.classes.nginxhost.ts | 13 +++++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/test/test.ts b/test/test.ts index e54c1e9..115b123 100644 --- a/test/test.ts +++ b/test/test.ts @@ -29,7 +29,6 @@ tap.test(`should produce an instance of NginxConfig`, async () => { publicKey: 'some public' }); expect(testNginxZone01).to.be.instanceof(smartnginx.NginxHost); - console.log(testNginxZone01.configString); }); tap.test('.addZone() should add a zone to NginxConfig Object', async () => { diff --git a/ts/smartnginx.classes.nginxhost.ts b/ts/smartnginx.classes.nginxhost.ts index 5b267d6..cb4e4c6 100644 --- a/ts/smartnginx.classes.nginxhost.ts +++ b/ts/smartnginx.classes.nginxhost.ts @@ -30,6 +30,8 @@ export class NginxHost implements IHostConfig { this.hostName = optionsArg.hostName; this.destination = optionsArg.destination; this.configString = snippets.getHostConfigString(optionsArg.hostName, optionsArg.destination); + this.privateKey = optionsArg.privateKey; + this.publicKey = optionsArg.publicKey; } /** @@ -37,8 +39,15 @@ export class NginxHost implements IHostConfig { * @param certInstanceArg */ public async deploy() { - const filePath = plugins.path.join(paths.nginxHostDirPath, `${this.hostName}.conf`); + const filePathConfig = plugins.path.join(paths.nginxHostDirPath, `${this.hostName}.conf`); + const filePathPrivate = plugins.path.join(paths.nginxHostDirPath, `${this.hostName}.private.pem`); + const filePathPublic = plugins.path.join(paths.nginxHostDirPath, `${this.hostName}.public.pem`); // writeConfig - plugins.smartfile.memory.toFsSync(this.configString, filePath); + plugins.smartfile.memory.toFsSync(this.configString, filePathConfig); + + // write ssl + plugins.smartfile.memory.toFsSync(this.privateKey, filePathPrivate); + plugins.smartfile.memory.toFsSync(this.publicKey, filePathPublic); + } }