fix(core): update
This commit is contained in:
8
ts/00_commitinfo_data.ts
Normal file
8
ts/00_commitinfo_data.ts
Normal file
@ -0,0 +1,8 @@
|
||||
/**
|
||||
* autocreated commitinfo by @pushrocks/commitinfo
|
||||
*/
|
||||
export const commitinfo = {
|
||||
name: '@push.rocks/smartnginx',
|
||||
version: '2.0.52',
|
||||
description: 'control nginx from node, TypeScript ready'
|
||||
}
|
@ -1,6 +1,4 @@
|
||||
import * as plugins from './smartnginx.plugins';
|
||||
|
||||
// classes
|
||||
export * from './smartnginx.classes.smartnginx';
|
||||
export * from './smartnginx.classes.nginxprocess';
|
||||
export * from './smartnginx.classes.nginxhost';
|
||||
export * from './smartnginx.classes.smartnginx.js';
|
||||
export * from './smartnginx.classes.nginxprocess.js';
|
||||
export * from './smartnginx.classes.nginxhost.js';
|
||||
|
@ -1,13 +1,13 @@
|
||||
import * as plugins from './smartnginx.plugins';
|
||||
import * as paths from './smartnginx.paths';
|
||||
import * as snippets from './smartnginx.snippets';
|
||||
import * as plugins from './smartnginx.plugins.js';
|
||||
import * as paths from './smartnginx.paths.js';
|
||||
import * as snippets from './smartnginx.snippets.js';
|
||||
|
||||
import { SmartNginx } from './smartnginx.classes.smartnginx';
|
||||
import { SmartNginx } from './smartnginx.classes.smartnginx.js';
|
||||
|
||||
import { IHostConfig } from './interfaces/hostconfig';
|
||||
import { type IHostConfig } from './interfaces/hostconfig.js';
|
||||
|
||||
export enum hostTypes {
|
||||
reverseProxy
|
||||
reverseProxy,
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1,9 +1,7 @@
|
||||
import * as plugins from './smartnginx.plugins';
|
||||
import * as paths from './smartnginx.paths';
|
||||
import { SmartNginx } from './smartnginx.classes.smartnginx';
|
||||
import { NginxHost } from './smartnginx.classes.nginxhost';
|
||||
|
||||
import { Smartshell } from '@pushrocks/smartshell';
|
||||
import * as plugins from './smartnginx.plugins.js';
|
||||
import * as paths from './smartnginx.paths.js';
|
||||
import { SmartNginx } from './smartnginx.classes.smartnginx.js';
|
||||
import { NginxHost } from './smartnginx.classes.nginxhost.js';
|
||||
|
||||
import { ChildProcess } from 'child_process';
|
||||
|
||||
@ -14,8 +12,8 @@ export class NginxProcess {
|
||||
public started: boolean = false;
|
||||
public smartNginxRef: SmartNginx;
|
||||
private nginxChildProcess: ChildProcess;
|
||||
private smartshellInstance = new Smartshell({
|
||||
executor: 'bash'
|
||||
private smartshellInstance = new plugins.smartshell.Smartshell({
|
||||
executor: 'bash',
|
||||
});
|
||||
|
||||
constructor(nginxRefArg: SmartNginx) {
|
||||
@ -27,12 +25,12 @@ export class NginxProcess {
|
||||
*/
|
||||
public async start() {
|
||||
if (!this.nginxChildProcess) {
|
||||
this.nginxChildProcess = (await this.smartshellInstance.execStreaming(
|
||||
`nginx -c ${paths.nginxConfFile}`
|
||||
)).childProcess;
|
||||
this.nginxChildProcess = (
|
||||
await this.smartshellInstance.execStreaming(`nginx -c ${paths.nginxConfFile}`)
|
||||
).childProcess;
|
||||
}
|
||||
this.started = true;
|
||||
plugins.smartlog.defaultLogger.log('info', 'started Nginx!');
|
||||
console.log('info', 'started Nginx!');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1,9 +1,9 @@
|
||||
import * as plugins from './smartnginx.plugins';
|
||||
import * as paths from './smartnginx.paths';
|
||||
import * as snippets from './smartnginx.snippets';
|
||||
import { NginxHost } from './smartnginx.classes.nginxhost';
|
||||
import { NginxProcess } from './smartnginx.classes.nginxprocess';
|
||||
import { IHostConfig } from './interfaces/hostconfig';
|
||||
import * as plugins from './smartnginx.plugins.js';
|
||||
import * as paths from './smartnginx.paths.js';
|
||||
import * as snippets from './smartnginx.snippets.js';
|
||||
import { NginxHost } from './smartnginx.classes.nginxhost.js';
|
||||
import { NginxProcess } from './smartnginx.classes.nginxprocess.js';
|
||||
import { type IHostConfig } from './interfaces/hostconfig.js';
|
||||
|
||||
export interface ISmartNginxContructorOptions {
|
||||
logger?: plugins.smartlog.Smartlog;
|
||||
@ -18,15 +18,17 @@ export class SmartNginx {
|
||||
public logger: plugins.smartlog.Smartlog;
|
||||
|
||||
// the objectmaps
|
||||
private deployedHosts = new plugins.lik.Objectmap<NginxHost>();
|
||||
private hostCandidates = new plugins.lik.Objectmap<NginxHost>();
|
||||
private deployedHosts = new plugins.lik.ObjectMap<NginxHost>();
|
||||
private hostCandidates = new plugins.lik.ObjectMap<NginxHost>();
|
||||
|
||||
public nginxProcess: NginxProcess = new NginxProcess(this);
|
||||
constructor(optionsArg: ISmartNginxContructorOptions) {
|
||||
this.options = optionsArg;
|
||||
this.options.logger
|
||||
? (this.logger = this.options.logger)
|
||||
: (this.logger = plugins.smartlog.defaultLogger);
|
||||
: (this.logger = new plugins.smartlog.Smartlog({
|
||||
logContext: null
|
||||
}));
|
||||
}
|
||||
|
||||
// ===================
|
||||
@ -48,7 +50,7 @@ export class SmartNginx {
|
||||
* @param hostNameArg
|
||||
*/
|
||||
public getDeployedNginxHostByHostName(hostNameArg: string): NginxHost {
|
||||
return this.deployedHosts.find(nginxHost => {
|
||||
return this.deployedHosts.findSync((nginxHost) => {
|
||||
return nginxHost.hostName === hostNameArg;
|
||||
});
|
||||
}
|
||||
@ -65,7 +67,7 @@ export class SmartNginx {
|
||||
*/
|
||||
public async removeDeployedHost(nginxHostArg: NginxHost) {
|
||||
if (this.hostCandidates.isEmpty()) {
|
||||
this.deployedHosts.forEach(hostArg => {
|
||||
this.deployedHosts.forEach((hostArg) => {
|
||||
this.hostCandidates.add(hostArg);
|
||||
});
|
||||
}
|
||||
@ -80,9 +82,9 @@ export class SmartNginx {
|
||||
private async areHostsDiverged(): Promise<boolean> {
|
||||
let hostCounter = 0;
|
||||
let unfoundHosts = 0;
|
||||
await this.hostCandidates.forEach(async hostCandidateArg => {
|
||||
await this.hostCandidates.forEach(async (hostCandidateArg) => {
|
||||
let foundHost = false;
|
||||
await this.deployedHosts.forEach(async deployedHostArg => {
|
||||
await this.deployedHosts.forEach(async (deployedHostArg) => {
|
||||
if (
|
||||
hostCandidateArg.hostName === deployedHostArg.hostName &&
|
||||
hostCandidateArg.destination === deployedHostArg.destination &&
|
||||
|
@ -1,7 +1,7 @@
|
||||
import * as plugins from './smartnginx.plugins';
|
||||
import * as plugins from './smartnginx.plugins.js';
|
||||
|
||||
// directories
|
||||
export const packageBase = plugins.path.join(__dirname, '../');
|
||||
export const packageBase = plugins.path.join(plugins.smartpath.get.dirnameFromImportMetaUrl(import.meta.url), '../');
|
||||
export const nginxConfigDirPath = plugins.path.join(packageBase, 'nginxconfig');
|
||||
export const nginxHostDirPath = plugins.path.join(nginxConfigDirPath, 'hosts');
|
||||
|
||||
|
@ -4,17 +4,18 @@ import * as path from 'path';
|
||||
export { path };
|
||||
|
||||
// @pushrocks scope
|
||||
import * as lik from '@pushrocks/lik';
|
||||
import * as smartlog from '@pushrocks/smartlog';
|
||||
import * as smartpromise from '@pushrocks/smartpromise';
|
||||
import * as smartshell from '@pushrocks/smartshell';
|
||||
import * as smartfile from '@pushrocks/smartfile';
|
||||
import * as smartstring from '@pushrocks/smartstring';
|
||||
import * as smartunique from '@pushrocks/smartunique';
|
||||
import * as lik from '@push.rocks/lik';
|
||||
import * as smartfile from '@push.rocks/smartfile';
|
||||
import * as smartlog from '@push.rocks/smartlog';
|
||||
import * as smartpath from '@push.rocks/smartpath';
|
||||
import * as smartpromise from '@push.rocks/smartpromise';
|
||||
import * as smartshell from '@push.rocks/smartshell';
|
||||
import * as smartstring from '@push.rocks/smartstring';
|
||||
import * as smartunique from '@push.rocks/smartunique';
|
||||
|
||||
export { lik, smartlog, smartpromise, smartshell, smartfile, smartstring, smartunique };
|
||||
export { lik, smartfile, smartlog, smartpath, smartpromise, smartshell, smartstring, smartunique };
|
||||
|
||||
// thirdparty scope
|
||||
import * as selfsigned from 'selfsigned';
|
||||
import * as selfsigned from 'selfsigned';
|
||||
|
||||
export { selfsigned };
|
||||
|
@ -1,5 +1,5 @@
|
||||
import * as plugins from './smartnginx.plugins';
|
||||
import * as paths from './smartnginx.paths';
|
||||
import * as plugins from './smartnginx.plugins.js';
|
||||
import * as paths from './smartnginx.paths.js';
|
||||
export let getBaseConfigString = (defaultProxy: string) => {
|
||||
const baseConfig = plugins.smartstring.indent.normalize(`
|
||||
user www-data;
|
||||
|
Reference in New Issue
Block a user