fix(core): cleanup
This commit is contained in:
parent
6a05c0087f
commit
4186e77ca0
3
dist/index.d.ts
vendored
3
dist/index.d.ts
vendored
@ -1,3 +0,0 @@
|
|||||||
export * from "./smartnginx.classes.nginxconfig";
|
|
||||||
export * from "./smartnginx.classes.nginxprocess";
|
|
||||||
export * from "./smartnginx.classes.nginxhost";
|
|
9
dist/index.js
vendored
9
dist/index.js
vendored
@ -1,9 +0,0 @@
|
|||||||
"use strict";
|
|
||||||
function __export(m) {
|
|
||||||
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
|
|
||||||
}
|
|
||||||
// classes
|
|
||||||
__export(require("./smartnginx.classes.nginxconfig"));
|
|
||||||
__export(require("./smartnginx.classes.nginxprocess"));
|
|
||||||
__export(require("./smartnginx.classes.nginxhost"));
|
|
||||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7O0FBRUEsVUFBVTtBQUNWLGlCQUFjLGtDQUFrQyxDQUFDLEVBQUE7QUFDakQsaUJBQWMsbUNBQW1DLENBQUMsRUFBQTtBQUNsRCxpQkFBYyxnQ0FBZ0MsQ0FBQyxFQUFBIn0=
|
|
19
dist/smartnginx.classes.nginxconfig.d.ts
vendored
19
dist/smartnginx.classes.nginxconfig.d.ts
vendored
@ -1,19 +0,0 @@
|
|||||||
/// <reference types="q" />
|
|
||||||
import * as plugins from "./smartnginx.plugins";
|
|
||||||
import { NginxHost } from "./smartnginx.classes.nginxhost";
|
|
||||||
import { NginxProcess } from "./smartnginx.classes.nginxprocess";
|
|
||||||
/**
|
|
||||||
* main class that manages a NginxInstance
|
|
||||||
*/
|
|
||||||
export declare class NginxConfig {
|
|
||||||
hosts: NginxHost[];
|
|
||||||
cert: plugins.cert.Cert;
|
|
||||||
nginxProcess: NginxProcess;
|
|
||||||
isDeployed: boolean;
|
|
||||||
constructor(optionsArg: plugins.cert.ICertConstructorOptions);
|
|
||||||
addHost(nginxHostArg: NginxHost): void;
|
|
||||||
listHosts(): NginxHost[];
|
|
||||||
removeHost(nginxHostArg: NginxHost): void;
|
|
||||||
clean(): void;
|
|
||||||
deploy(): plugins.q.Promise<{}>;
|
|
||||||
}
|
|
71
dist/smartnginx.classes.nginxconfig.js
vendored
71
dist/smartnginx.classes.nginxconfig.js
vendored
@ -1,71 +0,0 @@
|
|||||||
"use strict";
|
|
||||||
const plugins = require("./smartnginx.plugins");
|
|
||||||
const paths = require("./smartnginx.paths");
|
|
||||||
const snippets = require("./smartnginx.snippets");
|
|
||||||
const smartnginx_classes_nginxprocess_1 = require("./smartnginx.classes.nginxprocess");
|
|
||||||
let allConfigs = [];
|
|
||||||
/**
|
|
||||||
* main class that manages a NginxInstance
|
|
||||||
*/
|
|
||||||
class NginxConfig {
|
|
||||||
constructor(optionsArg) {
|
|
||||||
this.hosts = [];
|
|
||||||
this.nginxProcess = new smartnginx_classes_nginxprocess_1.NginxProcess(this);
|
|
||||||
this.isDeployed = false;
|
|
||||||
this.cert = new plugins.cert.Cert({
|
|
||||||
cfEmail: optionsArg.cfEmail,
|
|
||||||
cfKey: optionsArg.cfKey,
|
|
||||||
sslDir: paths.nginxCertBase,
|
|
||||||
gitOriginRepo: optionsArg.gitOriginRepo,
|
|
||||||
testMode: optionsArg.testMode
|
|
||||||
});
|
|
||||||
}
|
|
||||||
;
|
|
||||||
// interact with Hosts
|
|
||||||
addHost(nginxHostArg) {
|
|
||||||
this.hosts.push(nginxHostArg);
|
|
||||||
}
|
|
||||||
listHosts() {
|
|
||||||
return this.hosts;
|
|
||||||
}
|
|
||||||
;
|
|
||||||
removeHost(nginxHostArg) {
|
|
||||||
}
|
|
||||||
clean() {
|
|
||||||
this.hosts = [];
|
|
||||||
}
|
|
||||||
// handle deployment of hosts
|
|
||||||
deploy() {
|
|
||||||
let done = plugins.q.defer();
|
|
||||||
plugins.smartfile.fs.ensureDirSync(paths.nginxConfigBase);
|
|
||||||
plugins.smartfile.fs.ensureDirSync(paths.nginxHostFileBase);
|
|
||||||
plugins.smartfile.fs.ensureDirSync(paths.nginxCertBase);
|
|
||||||
for (let config of allConfigs) {
|
|
||||||
config.isDeployed = false;
|
|
||||||
}
|
|
||||||
;
|
|
||||||
this.isDeployed = true;
|
|
||||||
// write base config
|
|
||||||
plugins.smartfile.memory.toFsSync(snippets.getBaseConfigString(), paths.nginxConfFile);
|
|
||||||
// deploy hosts
|
|
||||||
let promiseArray = [];
|
|
||||||
for (let host of this.hosts) {
|
|
||||||
let hostDeployedPromise = host.deploy(this.cert);
|
|
||||||
hostDeployedPromise.then(() => {
|
|
||||||
plugins.beautylog.info(`Host ${host.hostName} deployed!`);
|
|
||||||
this.nginxProcess.reloadConfig();
|
|
||||||
});
|
|
||||||
promiseArray.push(hostDeployedPromise);
|
|
||||||
}
|
|
||||||
;
|
|
||||||
plugins.q.all(promiseArray)
|
|
||||||
.then(() => {
|
|
||||||
done.resolve();
|
|
||||||
});
|
|
||||||
return done.promise;
|
|
||||||
}
|
|
||||||
;
|
|
||||||
}
|
|
||||||
exports.NginxConfig = NginxConfig;
|
|
||||||
;
|
|
||||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRuZ2lueC5jbGFzc2VzLm5naW54Y29uZmlnLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvc21hcnRuZ2lueC5jbGFzc2VzLm5naW54Y29uZmlnLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQSxNQUFZLE9BQU8sV0FBTSxzQkFBc0IsQ0FBQyxDQUFBO0FBQ2hELE1BQVksS0FBSyxXQUFNLG9CQUFvQixDQUFDLENBQUE7QUFDNUMsTUFBWSxRQUFRLFdBQU0sdUJBQXVCLENBQUMsQ0FBQTtBQUVsRCxrREFBNkIs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QUFZLENBQUMsSUFBSSxDQUFDLG1CQUFtQixDQUFDLENBQUM7UUFDM0MsQ0FBQztRQUFBLENBQUM7UUFDRixPQUFPLENBQUMsQ0FBQyxDQUFDLEdBQUcsQ0FBQyxZQUFZLENBQUM7YUFDdEIsSUFBSSxDQUFDO1lBQ0YsSUFBSSxDQUFDLE9BQU8sRUFBRSxDQUFDO1FBQ25CLENBQUMsQ0FBQyxDQUFDO1FBRVAsTUFBTSxDQUFDLElBQUksQ0FBQyxPQUFPLENBQUM7SUFDeEIsQ0FBQzs7QUFDTCxDQUFDO0FBNURZLG1CQUFXLGNBNER2QixDQUFBO0FBQUEsQ0FBQyJ9
|
|
25
dist/smartnginx.classes.nginxhost.d.ts
vendored
25
dist/smartnginx.classes.nginxhost.d.ts
vendored
@ -1,25 +0,0 @@
|
|||||||
/// <reference types="q" />
|
|
||||||
import * as plugins from "./smartnginx.plugins";
|
|
||||||
/**
|
|
||||||
* the host config data that NginxHost needs to create a valid instance
|
|
||||||
*/
|
|
||||||
export interface IHostConfigData {
|
|
||||||
hostName: string;
|
|
||||||
type: hostTypes;
|
|
||||||
destination: string;
|
|
||||||
}
|
|
||||||
export declare enum hostTypes {
|
|
||||||
reverseProxy = 0,
|
|
||||||
static = 1,
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* manages a single nginx host
|
|
||||||
*/
|
|
||||||
export declare class NginxHost {
|
|
||||||
hostName: string;
|
|
||||||
type: hostTypes;
|
|
||||||
destination: string;
|
|
||||||
configString: string;
|
|
||||||
constructor(optionsArg: IHostConfigData);
|
|
||||||
deploy(certInstanceArg: plugins.cert.Cert): plugins.q.Promise<{}>;
|
|
||||||
}
|
|
35
dist/smartnginx.classes.nginxhost.js
vendored
35
dist/smartnginx.classes.nginxhost.js
vendored
@ -1,35 +0,0 @@
|
|||||||
"use strict";
|
|
||||||
const plugins = require("./smartnginx.plugins");
|
|
||||||
const paths = require("./smartnginx.paths");
|
|
||||||
const snippets = require("./smartnginx.snippets");
|
|
||||||
(function (hostTypes) {
|
|
||||||
hostTypes[hostTypes["reverseProxy"] = 0] = "reverseProxy";
|
|
||||||
hostTypes[hostTypes["static"] = 1] = "static";
|
|
||||||
})(exports.hostTypes || (exports.hostTypes = {}));
|
|
||||||
var hostTypes = exports.hostTypes;
|
|
||||||
/**
|
|
||||||
* manages a single nginx host
|
|
||||||
*/
|
|
||||||
class NginxHost {
|
|
||||||
constructor(optionsArg) {
|
|
||||||
this.hostName = optionsArg.hostName;
|
|
||||||
this.type = optionsArg.type;
|
|
||||||
this.destination = optionsArg.destination;
|
|
||||||
this.configString = snippets.getHostConfigString(optionsArg.hostName, optionsArg.destination);
|
|
||||||
}
|
|
||||||
;
|
|
||||||
deploy(certInstanceArg) {
|
|
||||||
let done = plugins.q.defer();
|
|
||||||
let filePath = plugins.path.join(paths.nginxHostFileBase, this.hostName + ".conf");
|
|
||||||
// writeConfig
|
|
||||||
plugins.smartfile.memory.toFsSync(this.configString, filePath);
|
|
||||||
// get cert
|
|
||||||
certInstanceArg.getDomainCert(this.hostName)
|
|
||||||
.then(done.resolve);
|
|
||||||
return done.promise;
|
|
||||||
}
|
|
||||||
;
|
|
||||||
}
|
|
||||||
exports.NginxHost = NginxHost;
|
|
||||||
;
|
|
||||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRuZ2lueC5jbGFzc2VzLm5naW54aG9zdC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL3NtYXJ0bmdpbnguY2xhc3Nlcy5uZ2lueGhvc3QudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLE1BQVksT0FBTyxXQUFNLHNCQUFzQixDQUFDLENBQUE7QUFDaEQsTUFBWSxLQUFLLFdBQU0sb0JBQW9CLENBQUMsQ0FBQTtBQUM1QyxNQUFZLFFBQVEsV0FBTSx1QkFLMUIsQ0FBQyxDQUxnRDtBQVdqRCxXQUFZLFNBQV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FDeEIsQ0FBQzs7QUFDTCxDQUFDO0FBckJZLGlCQUFTLFlBcUJyQixDQUFBO0FBQUEsQ0FBQyJ9
|
|
29
dist/smartnginx.classes.nginxprocess.d.ts
vendored
29
dist/smartnginx.classes.nginxprocess.d.ts
vendored
@ -1,29 +0,0 @@
|
|||||||
/// <reference types="node" />
|
|
||||||
/// <reference types="q" />
|
|
||||||
import * as plugins from "./smartnginx.plugins";
|
|
||||||
import { NginxConfig } from "./smartnginx.classes.nginxconfig";
|
|
||||||
/**
|
|
||||||
* manages a nginxprocess for an NginxConfig
|
|
||||||
*/
|
|
||||||
export declare class NginxProcess {
|
|
||||||
started: boolean;
|
|
||||||
nginxConfig: NginxConfig;
|
|
||||||
nginxChildProcess: plugins.childProcess.ChildProcess;
|
|
||||||
constructor(nginxConfigArg: any);
|
|
||||||
/**
|
|
||||||
* start nginx
|
|
||||||
*/
|
|
||||||
start(): plugins.q.Promise<{}>;
|
|
||||||
/**
|
|
||||||
* reload config
|
|
||||||
*/
|
|
||||||
reloadConfig(): plugins.q.Promise<{}>;
|
|
||||||
/**
|
|
||||||
* stop the nginx instance
|
|
||||||
*/
|
|
||||||
stop(): plugins.q.Promise<{}>;
|
|
||||||
/**
|
|
||||||
* checks if nginx is in path
|
|
||||||
*/
|
|
||||||
check(): boolean;
|
|
||||||
}
|
|
79
dist/smartnginx.classes.nginxprocess.js
vendored
79
dist/smartnginx.classes.nginxprocess.js
vendored
@ -1,79 +0,0 @@
|
|||||||
"use strict";
|
|
||||||
const plugins = require("./smartnginx.plugins");
|
|
||||||
const paths = require("./smartnginx.paths");
|
|
||||||
/**
|
|
||||||
* manages a nginxprocess for an NginxConfig
|
|
||||||
*/
|
|
||||||
class NginxProcess {
|
|
||||||
constructor(nginxConfigArg) {
|
|
||||||
this.started = false;
|
|
||||||
this.nginxConfig = nginxConfigArg;
|
|
||||||
}
|
|
||||||
;
|
|
||||||
/**
|
|
||||||
* start nginx
|
|
||||||
*/
|
|
||||||
start() {
|
|
||||||
let done = plugins.q.defer();
|
|
||||||
if (typeof this.nginxChildProcess == "undefined") {
|
|
||||||
this.nginxChildProcess = plugins.childProcess.exec(`nginx -c ${paths.nginxConfFile}`, function (error, stdout, stderr) {
|
|
||||||
console.log(`stdout: ${stdout}`);
|
|
||||||
console.log(`stderr: ${stderr}`);
|
|
||||||
if (error !== null) {
|
|
||||||
console.log(`exec error: ${error}`);
|
|
||||||
}
|
|
||||||
;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
;
|
|
||||||
this.started = true;
|
|
||||||
plugins.beautylog.info("started Nginx!");
|
|
||||||
done.resolve();
|
|
||||||
return done.promise;
|
|
||||||
}
|
|
||||||
;
|
|
||||||
/**
|
|
||||||
* reload config
|
|
||||||
*/
|
|
||||||
reloadConfig() {
|
|
||||||
let done = plugins.q.defer();
|
|
||||||
if (this.started == false) {
|
|
||||||
this.start();
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
plugins.shelljs.exec("nginx -s reload");
|
|
||||||
}
|
|
||||||
;
|
|
||||||
plugins.beautylog.ok("NginxProcess has loaded the new config!");
|
|
||||||
done.resolve();
|
|
||||||
return done.promise;
|
|
||||||
}
|
|
||||||
;
|
|
||||||
/**
|
|
||||||
* stop the nginx instance
|
|
||||||
*/
|
|
||||||
stop() {
|
|
||||||
let done = plugins.q.defer();
|
|
||||||
if (typeof this.nginxChildProcess != "undefined") {
|
|
||||||
plugins.shelljs.exec("nginx -s quit");
|
|
||||||
this.started = false;
|
|
||||||
plugins.beautylog.info("stopped Nginx!");
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
plugins.beautylog.log("nginx already stopped!");
|
|
||||||
}
|
|
||||||
;
|
|
||||||
done.resolve();
|
|
||||||
return done.promise;
|
|
||||||
}
|
|
||||||
;
|
|
||||||
/**
|
|
||||||
* checks if nginx is in path
|
|
||||||
*/
|
|
||||||
check() {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
;
|
|
||||||
}
|
|
||||||
exports.NginxProcess = NginxPro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CQUFpQixJQUFJLFdBQVcsQ0FBQyxDQUFDLENBQUM7WUFDL0MsT0FBTyxDQUFDLE9BQU8sQ0FBQyxJQUFJLENBQUMsZUFBZSxDQUFDLENBQUM7WUFDdEMsSUFBSSxDQUFDLE9BQU8sR0FBRyxLQUFLLENBQUM7WUFDckIsT0FBTyxDQUFDLFNBQVMsQ0FBQyxJQUFJLENBQUMsZ0JBQWdCLENBQUMsQ0FBQztRQUM3QyxDQUFDO1FBQUMsSUFBSSxDQUFDLENBQUM7WUFDSixPQUFPLENBQUMsU0FBUyxDQUFDLEdBQUcsQ0FBQyx3QkFBd0IsQ0FBQyxDQUFDO1FBQ3BELENBQUM7UUFBQSxDQUFDO1FBQ0YsSUFBSSxDQUFDLE9BQU8sRUFBRSxDQUFDO1FBQ2YsTUFBTSxDQUFDLElBQUksQ0FBQyxPQUFPLENBQUM7SUFDeEIsQ0FBQzs7SUFFRDs7T0FFRztJQUNILEtBQUs7UUFDRCxNQUFNLENBQUM7SUFDWCxDQUFDOztBQUNMLENBQUM7QUFqRVksb0JBQVksZUFpRXhCLENBQUEifQ==
|
|
5
dist/smartnginx.paths.d.ts
vendored
5
dist/smartnginx.paths.d.ts
vendored
@ -1,5 +0,0 @@
|
|||||||
export declare let packageBase: string;
|
|
||||||
export declare let nginxConfigBase: string;
|
|
||||||
export declare let nginxHostFileBase: string;
|
|
||||||
export declare let nginxCertBase: string;
|
|
||||||
export declare let nginxConfFile: string;
|
|
10
dist/smartnginx.paths.js
vendored
10
dist/smartnginx.paths.js
vendored
@ -1,10 +0,0 @@
|
|||||||
"use strict";
|
|
||||||
const plugins = require("./smartnginx.plugins");
|
|
||||||
// directories
|
|
||||||
exports.packageBase = plugins.path.join(__dirname, "../");
|
|
||||||
exports.nginxConfigBase = plugins.path.join(exports.packageBase, "nginxconfig");
|
|
||||||
exports.nginxHostFileBase = plugins.path.join(exports.nginxConfigBase, "hosts");
|
|
||||||
exports.nginxCertBase = plugins.path.join(exports.nginxConfigBase, "cert");
|
|
||||||
// files
|
|
||||||
exports.nginxConfFile = plugins.path.join(exports.nginxConfigBase, "nginx.conf");
|
|
||||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRuZ2lueC5wYXRocy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL3NtYXJ0bmdpbngucGF0aHMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLE1BQVksT0FBTyxXQUFNLHNCQUd6QixDQUFDLENBSDhDO0FBRS9DLGNBQWM7QUFDSCxtQkFBVyxHQUFHLE9BQU8sQ0FBQyxJQUFJLENBQUMsSUFBSSxDQUFDLFNBQVMsRUFBQyxLQUFLLENBQUMsQ0FBQztBQUNqRCx1QkFBZSxHQUFHLE9BQU8sQ0FBQyxJQUFJLENBQUMsSUFBSSxDQUFDLG1CQUFXLEVBQUMsYUFBYSxDQUFDLENBQUM7QUFDL0QseUJBQWlCLEdBQUcsT0FBTyxDQUFDLElBQUksQ0FBQyxJQUFJLENBQUMsdUJBQWUsRUFBQyxPQUFPLENBQUMsQ0FBQztBQUMvRCxxQkFBYSxHQUFHLE9BQU8sQ0FBQyxJQUFJLENBQUMsSUFBSSxDQUFDLHVCQUFlLEVBQUMsTUFBTSxDQUFDLENBQUM7QUFFckUsUUFBUTtBQUNHLHFCQUFhLEdBQUcsT0FBTyxDQUFDLElBQUksQ0FBQyxJQUFJLENBQUMsdUJBQWUsRUFBQyxZQUFZLENBQUMsQ0FBQyJ9
|
|
9
dist/smartnginx.plugins.d.ts
vendored
9
dist/smartnginx.plugins.d.ts
vendored
@ -1,9 +0,0 @@
|
|||||||
import "typings-global";
|
|
||||||
export import beautylog = require("beautylog");
|
|
||||||
export import cert = require("cert");
|
|
||||||
export import childProcess = require("child_process");
|
|
||||||
export import path = require("path");
|
|
||||||
export import q = require("q");
|
|
||||||
export import shelljs = require("shelljs");
|
|
||||||
export import smartfile = require("smartfile");
|
|
||||||
export import smartstring = require("smartstring");
|
|
11
dist/smartnginx.plugins.js
vendored
11
dist/smartnginx.plugins.js
vendored
@ -1,11 +0,0 @@
|
|||||||
"use strict";
|
|
||||||
require("typings-global");
|
|
||||||
exports.beautylog = require("beautylog");
|
|
||||||
exports.cert = require("cert");
|
|
||||||
exports.childProcess = require("child_process");
|
|
||||||
exports.path = require("path");
|
|
||||||
exports.q = require("q");
|
|
||||||
exports.shelljs = require("shelljs");
|
|
||||||
exports.smartfile = require("smartfile");
|
|
||||||
exports.smartstring = require("smartstring");
|
|
||||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRuZ2lueC5wbHVnaW5zLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvc21hcnRuZ2lueC5wbHVnaW5zLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQSxRQUFPLGdCQUFnQixDQUFDLENBQUE7QUFDVixpQkFBUyxXQUFXLFdBQVcsQ0FBQyxDQUFDO0FBQ2pDLFlBQUksV0FBVyxNQUFNLENBQUMsQ0FBQztBQUN2QixvQkFBWSxXQUFXLGVBQWUsQ0FBQyxDQUFDO0FBQ3hDLFlBQUksV0FBVyxNQUFNLENBQUMsQ0FBQztBQUN2QixTQUFDLFdBQVcsR0FBRyxDQUFDLENBQUM7QUFDakIsZUFBTyxXQUFXLFNBQVMsQ0FBQyxDQUFDO0FBQzdCLGlCQUFTLFdBQVcsV0FBVyxDQUFDLENBQUM7QUFDakMsbUJBQVcsV0FBVyxhQUFhLENBQUMsQ0FBQyJ9
|
|
2
dist/smartnginx.snippets.d.ts
vendored
2
dist/smartnginx.snippets.d.ts
vendored
@ -1,2 +0,0 @@
|
|||||||
export declare let getBaseConfigString: () => string;
|
|
||||||
export declare let getHostConfigString: (hostNameArg: string, destinationIpArg: string) => string;
|
|
103
dist/smartnginx.snippets.js
vendored
103
dist/smartnginx.snippets.js
vendored
@ -1,103 +0,0 @@
|
|||||||
"use strict";
|
|
||||||
const plugins = require("./smartnginx.plugins");
|
|
||||||
const paths = require("./smartnginx.paths");
|
|
||||||
exports.getBaseConfigString = () => {
|
|
||||||
let baseConfig = plugins.smartstring.indent.normalize(`
|
|
||||||
user www-data;
|
|
||||||
worker_processes auto;
|
|
||||||
pid /run/nginx.pid;
|
|
||||||
|
|
||||||
events {
|
|
||||||
worker_connections 768;
|
|
||||||
# multi_accept on;
|
|
||||||
}
|
|
||||||
|
|
||||||
http {
|
|
||||||
server_names_hash_bucket_size 128;
|
|
||||||
|
|
||||||
##
|
|
||||||
# Basic Settings
|
|
||||||
##
|
|
||||||
|
|
||||||
sendfile on;
|
|
||||||
tcp_nopush on;
|
|
||||||
tcp_nodelay on;
|
|
||||||
keepalive_timeout 65;
|
|
||||||
types_hash_max_size 2048;
|
|
||||||
# server_tokens off;
|
|
||||||
|
|
||||||
# server_names_hash_bucket_size 64;
|
|
||||||
# server_name_in_redirect off;
|
|
||||||
|
|
||||||
include /etc/nginx/mime.types;
|
|
||||||
default_type application/octet-stream;
|
|
||||||
|
|
||||||
##
|
|
||||||
# SSL Settings
|
|
||||||
##
|
|
||||||
|
|
||||||
ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # Dropping SSLv3, ref: POODLE
|
|
||||||
ssl_prefer_server_ciphers on;
|
|
||||||
|
|
||||||
##
|
|
||||||
# Logging Settings
|
|
||||||
##
|
|
||||||
|
|
||||||
access_log /var/log/nginx/access.log;
|
|
||||||
error_log /var/log/nginx/error.log;
|
|
||||||
|
|
||||||
##
|
|
||||||
# Gzip Settings
|
|
||||||
##
|
|
||||||
|
|
||||||
gzip on;
|
|
||||||
gzip_disable "msie6";
|
|
||||||
|
|
||||||
# gzip_vary on;
|
|
||||||
# gzip_proxied any;
|
|
||||||
# gzip_comp_level 6;
|
|
||||||
# gzip_buffers 16 8k;
|
|
||||||
# gzip_http_version 1.1;
|
|
||||||
# gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;
|
|
||||||
|
|
||||||
##
|
|
||||||
# Virtual Host Configs
|
|
||||||
##
|
|
||||||
|
|
||||||
include ${paths.nginxHostFileBase}/*.conf;
|
|
||||||
include /etc/nginx/sites-enabled/*;
|
|
||||||
}
|
|
||||||
daemon off;
|
|
||||||
`);
|
|
||||||
return baseConfig;
|
|
||||||
};
|
|
||||||
exports.getHostConfigString = (hostNameArg, destinationIpArg) => {
|
|
||||||
let hostConfig = plugins.smartstring.indent.normalize(`
|
|
||||||
upstream ${hostNameArg} {
|
|
||||||
server ${destinationIpArg};
|
|
||||||
}
|
|
||||||
|
|
||||||
server {
|
|
||||||
listen *:80 ;
|
|
||||||
server_name ${hostNameArg};
|
|
||||||
rewrite ^ https://${hostNameArg}$request_uri? permanent;
|
|
||||||
}
|
|
||||||
|
|
||||||
server {
|
|
||||||
listen *:443 ssl;
|
|
||||||
server_name ${hostNameArg};
|
|
||||||
ssl_certificate ${paths.nginxCertBase}/${hostNameArg}/fullchain.pem;
|
|
||||||
ssl_certificate_key ${paths.nginxCertBase}/${hostNameArg}/privkey.pem;
|
|
||||||
|
|
||||||
location / {
|
|
||||||
proxy_pass http://${hostNameArg};
|
|
||||||
include /etc/nginx/proxy_params;
|
|
||||||
}
|
|
||||||
location ~ /\.git {
|
|
||||||
deny all;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
`);
|
|
||||||
return hostConfig;
|
|
||||||
};
|
|
||||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRuZ2lueC5zbmlwcGV0cy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL3NtYXJ0bmdpbnguc25pcHBldHMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLE1BQVksT0FBTyxXQUFNLHNCQUFzQixDQUFDLENBQUE7QUFDaEQsTUFBWSxLQUFLLFdBQU0sb0JBQW9CLENBQ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