Compare commits
6 Commits
Author | SHA1 | Date | |
---|---|---|---|
c65b8fc1af | |||
b7b588d713 | |||
00d672c135 | |||
6a1e778b49 | |||
4cfb26f62f | |||
7ba3ad0b21 |
2
package-lock.json
generated
2
package-lock.json
generated
@ -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": {
|
||||||
|
@ -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",
|
||||||
|
@ -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 () => {
|
||||||
|
@ -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);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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};
|
||||||
|
Reference in New Issue
Block a user