diff --git a/npmextra.json b/npmextra.json index 4ff49cf..0d5cb21 100644 --- a/npmextra.json +++ b/npmextra.json @@ -1,5 +1,8 @@ { "npmci": { "npmAccessLevel": "public" + }, + "npmdocker": { + } } \ No newline at end of file diff --git a/ts/smartnginx.classes.certhandler.ts b/ts/smartnginx.classes.certhandler.ts index 94a2a91..60d7e0f 100644 --- a/ts/smartnginx.classes.certhandler.ts +++ b/ts/smartnginx.classes.certhandler.ts @@ -1,5 +1,15 @@ import * as plugins from './smartnginx.plugins'; 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) { + + } } \ No newline at end of file diff --git a/ts/smartnginx.classes.smartnginx.ts b/ts/smartnginx.classes.smartnginx.ts index f355f59..9817a51 100644 --- a/ts/smartnginx.classes.smartnginx.ts +++ b/ts/smartnginx.classes.smartnginx.ts @@ -26,10 +26,22 @@ export class SmartNginx { * add a host * @param nginxHostArg */ - addHost(nginxHostArg: NginxHost) { - this.hosts.push(nginxHostArg); + addHost(hostNameArg: string, destinationIp: string): NginxHost { + 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 */