Compare commits

...

6 Commits

Author SHA1 Message Date
c65b8fc1af 2.0.11 2019-01-09 14:10:57 +01:00
b7b588d713 fix(core): update 2019-01-09 14:10:57 +01:00
00d672c135 2.0.10 2019-01-09 12:18:56 +01:00
6a1e778b49 fix(core): update 2019-01-09 12:18:56 +01:00
4cfb26f62f 2.0.9 2019-01-09 12:18:07 +01:00
7ba3ad0b21 fix(core): update 2019-01-09 12:18:06 +01:00
5 changed files with 16 additions and 8 deletions

2
package-lock.json generated
View File

@ -1,6 +1,6 @@
{ {
"name": "@pushrocks/smartnginx", "name": "@pushrocks/smartnginx",
"version": "2.0.8", "version": "2.0.11",
"lockfileVersion": 1, "lockfileVersion": 1,
"requires": true, "requires": true,
"dependencies": { "dependencies": {

View File

@ -1,6 +1,6 @@
{ {
"name": "@pushrocks/smartnginx", "name": "@pushrocks/smartnginx",
"version": "2.0.8", "version": "2.0.11",
"private": false, "private": false,
"description": "control nginx from node, TypeScript ready", "description": "control nginx from node, TypeScript ready",
"main": "dist/index.js", "main": "dist/index.js",

View File

@ -29,7 +29,6 @@ tap.test(`should produce an instance of NginxConfig`, async () => {
publicKey: 'some public' publicKey: 'some public'
}); });
expect(testNginxZone01).to.be.instanceof(smartnginx.NginxHost); expect(testNginxZone01).to.be.instanceof(smartnginx.NginxHost);
console.log(testNginxZone01.configString);
}); });
tap.test('.addZone() should add a zone to NginxConfig Object', async () => { tap.test('.addZone() should add a zone to NginxConfig Object', async () => {

View File

@ -30,6 +30,8 @@ export class NginxHost implements IHostConfig {
this.hostName = optionsArg.hostName; this.hostName = optionsArg.hostName;
this.destination = optionsArg.destination; this.destination = optionsArg.destination;
this.configString = snippets.getHostConfigString(optionsArg.hostName, 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 * @param certInstanceArg
*/ */
public async deploy() { 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 // 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);
} }
} }

View File

@ -63,7 +63,7 @@ export let getBaseConfigString = () => {
# Virtual Host Configs # Virtual Host Configs
## ##
include ${paths.nginxHostFileBase}/*.conf; include ${paths.nginxHostDirPath}/*.conf;
include /etc/nginx/sites-enabled/*; include /etc/nginx/sites-enabled/*;
} }
daemon off; daemon off;
@ -86,8 +86,8 @@ export let getHostConfigString = (hostNameArg: string, destinationIpArg: string)
server { server {
listen *:443 ssl; listen *:443 ssl;
server_name ${hostNameArg}; server_name ${hostNameArg};
ssl_certificate ${paths.nginxCertBase}/${hostNameArg}/fullchain.pem; ssl_certificate ${paths.nginxHostDirPath}/${hostNameArg}.public.pem;
ssl_certificate_key ${paths.nginxCertBase}/${hostNameArg}/privkey.pem; ssl_certificate_key ${paths.nginxHostDirPath}/${hostNameArg}.private.pem;
location / { location / {
proxy_pass http://${hostNameArg}; proxy_pass http://${hostNameArg};