fix(core): update

This commit is contained in:
2019-01-09 12:15:28 +01:00
parent 1049920efd
commit ede884930e
12 changed files with 316 additions and 142 deletions

View File

@ -4,13 +4,7 @@ import * as snippets from './smartnginx.snippets';
import { SmartNginx } from './smartnginx.classes.smartnginx';
/**
* the host config data that NginxHost needs to create a valid instance
*/
export interface IHostConfigData {
hostName: string;
destination: string;
}
import { IHostConfig } from './interfaces/hostconfig';
export enum hostTypes {
reverseProxy
@ -19,16 +13,19 @@ export enum hostTypes {
/**
* manages a single nginx host
*/
export class NginxHost {
/**
export class NginxHost implements IHostConfig {
/**
* smartnginxInstance this NginHost belongs to
*/
smartnginxInstance: SmartNginx
smartnginxInstance: SmartNginx;
hostName: string; // the host name e.g. domain name
destination: string;
configString: string; // the actual host config file as string
constructor(smartnginxInstanceArg: SmartNginx, optionsArg: IHostConfigData) {
privateKey: string;
publicKey: string;
constructor(smartnginxInstanceArg: SmartNginx, optionsArg: IHostConfig) {
this.smartnginxInstance = smartnginxInstanceArg;
this.hostName = optionsArg.hostName;
this.destination = optionsArg.destination;
@ -39,8 +36,8 @@ export class NginxHost {
*
* @param certInstanceArg
*/
async deploy() {
let filePath = plugins.path.join(paths.nginxHostFileBase, this.hostName + '.conf');
public async deploy() {
const filePath = plugins.path.join(paths.nginxHostDirPath, `${this.hostName}.conf`);
// writeConfig
plugins.smartfile.memory.toFsSync(this.configString, filePath);
}