Compare commits
6 Commits
Author | SHA1 | Date | |
---|---|---|---|
987e19372a | |||
0b97aaee91 | |||
b87ca1fa03 | |||
824f872fa5 | |||
80248c77d0 | |||
f592150646 |
@ -1,5 +1,8 @@
|
|||||||
{
|
{
|
||||||
"npmci": {
|
"npmci": {
|
||||||
"npmAccessLevel": "public"
|
"npmAccessLevel": "public"
|
||||||
|
},
|
||||||
|
"npmdocker": {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
817
package-lock.json
generated
817
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
18
package.json
18
package.json
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@pushrocks/smartnginx",
|
"name": "@pushrocks/smartnginx",
|
||||||
"version": "2.0.3",
|
"version": "2.0.6",
|
||||||
"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",
|
||||||
@ -24,17 +24,17 @@
|
|||||||
},
|
},
|
||||||
"homepage": "https://gitlab.com/pushrocks/smartnginx#README",
|
"homepage": "https://gitlab.com/pushrocks/smartnginx#README",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@pushrocks/smartfile": "^6.0.6",
|
"@pushrocks/smartfile": "^6.0.11",
|
||||||
"@pushrocks/smartlog": "^2.0.1",
|
"@pushrocks/smartlog": "^2.0.9",
|
||||||
"@pushrocks/smartpromise": "^2.0.5",
|
"@pushrocks/smartpromise": "^2.0.5",
|
||||||
"@pushrocks/smartshell": "^2.0.6",
|
"@pushrocks/smartshell": "^2.0.13",
|
||||||
"@pushrocks/smartstring": "^3.0.0"
|
"@pushrocks/smartstring": "^3.0.5"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@gitzone/tsbuild": "^2.0.22",
|
"@gitzone/tsbuild": "^2.1.4",
|
||||||
"@gitzone/tsrun": "^1.1.12",
|
"@gitzone/tsrun": "^1.1.17",
|
||||||
"@gitzone/tstest": "^1.0.13",
|
"@gitzone/tstest": "^1.0.18",
|
||||||
"@pushrocks/tapbundle": "^3.0.5",
|
"@pushrocks/tapbundle": "^3.0.7",
|
||||||
"qenv": "^1.1.7"
|
"qenv": "^1.1.7"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -30,8 +30,8 @@ tap.test(`should produce an instance of NginxConfig`, async () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
tap.test('.addZone() should add a zone to NginxConfig Object', async () => {
|
tap.test('.addZone() should add a zone to NginxConfig Object', async () => {
|
||||||
testSmartNginx.addHost(testNginxZone01);
|
testSmartNginx.addHost('test200.bleu.de', '192.192.192.191');
|
||||||
testSmartNginx.addHost(testNginxZone02);
|
testSmartNginx.addHost('test201.blue.de', '192.192.192.191');
|
||||||
});
|
});
|
||||||
|
|
||||||
tap.test('.deploy() should deploy a config from an instance', async () => {
|
tap.test('.deploy() should deploy a config from an instance', async () => {
|
||||||
|
@ -1,5 +1,15 @@
|
|||||||
import * as plugins from './smartnginx.plugins';
|
import * as plugins from './smartnginx.plugins';
|
||||||
|
|
||||||
export class CertHandler {
|
export class CertHandler {
|
||||||
|
private _readyDeferred = plugins.smartpromise.defer();
|
||||||
|
certHandlerReady = this._readyDeferred.promise;
|
||||||
|
constructor() {} // nothing to do here for now
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ensure a cert is at the right location
|
||||||
|
* @param hostName
|
||||||
|
*/
|
||||||
|
async ensureCertForHost(hostName) {
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
@ -37,7 +37,7 @@ export class NginxProcess {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
this.started = true;
|
this.started = true;
|
||||||
plugins.smartlog.defaultLogger.info('started Nginx!');
|
plugins.smartlog.defaultLogger.log('info', 'started Nginx!');
|
||||||
done.resolve();
|
done.resolve();
|
||||||
return done.promise;
|
return done.promise;
|
||||||
}
|
}
|
||||||
@ -52,7 +52,7 @@ export class NginxProcess {
|
|||||||
} else {
|
} else {
|
||||||
this.smartshellInstance.exec('nginx -s reload');
|
this.smartshellInstance.exec('nginx -s reload');
|
||||||
}
|
}
|
||||||
plugins.smartlog.defaultLogger.info('NginxProcess has loaded the new config!');
|
plugins.smartlog.defaultLogger.log('info', 'NginxProcess has loaded the new config!');
|
||||||
done.resolve();
|
done.resolve();
|
||||||
return done.promise;
|
return done.promise;
|
||||||
}
|
}
|
||||||
@ -65,9 +65,9 @@ export class NginxProcess {
|
|||||||
if (typeof this.nginxChildProcess != 'undefined') {
|
if (typeof this.nginxChildProcess != 'undefined') {
|
||||||
this.smartshellInstance.exec('nginx -s quit');
|
this.smartshellInstance.exec('nginx -s quit');
|
||||||
this.started = false;
|
this.started = false;
|
||||||
plugins.smartlog.defaultLogger.info('stopped Nginx!');
|
plugins.smartlog.defaultLogger.log('info', 'stopped Nginx!');
|
||||||
} else {
|
} else {
|
||||||
plugins.smartlog.defaultLogger.info('nginx already stopped!');
|
plugins.smartlog.defaultLogger.log('info', 'nginx already stopped!');
|
||||||
}
|
}
|
||||||
done.resolve();
|
done.resolve();
|
||||||
return done.promise;
|
return done.promise;
|
||||||
|
@ -26,10 +26,22 @@ export class SmartNginx {
|
|||||||
* add a host
|
* add a host
|
||||||
* @param nginxHostArg
|
* @param nginxHostArg
|
||||||
*/
|
*/
|
||||||
addHost(nginxHostArg: NginxHost) {
|
addHost(hostNameArg: string, destinationIp: string): NginxHost {
|
||||||
this.hosts.push(nginxHostArg);
|
const nginxHost = new NginxHost(this, {
|
||||||
|
hostName: hostNameArg,
|
||||||
|
destination: destinationIp
|
||||||
|
})
|
||||||
|
this.hosts.push(nginxHost);
|
||||||
|
return nginxHost;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getNginxHostByHostName(hostNameArg: string): NginxHost {
|
||||||
|
return this.hosts.find(nginxHost => {
|
||||||
|
return nginxHost.hostName === hostNameArg;
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* listHosts
|
* listHosts
|
||||||
*/
|
*/
|
||||||
@ -67,7 +79,7 @@ export class SmartNginx {
|
|||||||
let promiseArray = [];
|
let promiseArray = [];
|
||||||
for (let host of this.hosts) {
|
for (let host of this.hosts) {
|
||||||
await host.deploy();
|
await host.deploy();
|
||||||
plugins.smartlog.defaultLogger.info(`Host ${host.hostName} deployed!`);
|
plugins.smartlog.defaultLogger.log('info', `Host ${host.hostName} deployed!`);
|
||||||
this.nginxProcess.reloadConfig();
|
this.nginxProcess.reloadConfig();
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user