Skip to content

Commit

Permalink
Update platform.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
donavanbecker committed Dec 31, 2023
1 parent 2217311 commit a101b3b
Showing 1 changed file with 4 additions and 19 deletions.
23 changes: 4 additions & 19 deletions src/platform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,11 +93,8 @@ export class CloudflaredTunnelPlatform implements DynamicPlatformPlugin {
* Verify the config passed to the plugin is valid
*/
async verifyConfig() {
if (!this.config.url && !this.config.hostname) {
throw new Error('Missing required config: url');
}
if (!this.config.port && !this.config.hostname && !this.config.url && !this.config.protocol && !this.config.url) {
throw new Error('Missing one of the following configs: port, hostname, url, protocol, please check your config.json');
if (!this.config.url && (!this.config.protocol && !this.config.hostname && !this.config.port)) {
throw new Error('Missing required config: url or {protocol}://{hostname}:{port}, please check your config.json');
}
if (this.config.url && this.config.hostname) {
// this.debugLog(`URL: ${this.config.url}`);
Expand All @@ -107,18 +104,6 @@ export class CloudflaredTunnelPlatform implements DynamicPlatformPlugin {
if (!this.config.logging) {
this.config.logging = 'standard';
}
if (!this.config.hostname) {
this.config.hostname = 'localhost';
}
if (!this.config.port) {
this.config.port = 8581;
}
if (!this.config.protocol) {
this.config.protocol = 'http';
}
if (!this.config.verifyTLS) {
this.config.verifyTLS = false;
}
if (!this.config.startTunnelAuto) {
this.config.startTunnelAuto = false;
}
Expand All @@ -129,9 +114,9 @@ export class CloudflaredTunnelPlatform implements DynamicPlatformPlugin {
//The local server URL to tunnel.
const options: TunnelOptions = {
url: this.config.url,
port: this.config.port,
hostname: this.config.hostname,
protocol: this.config.protocol,
hostname: this.config.hostname,
port: this.config.port,
verifyTLS: this.config.verifyTLS,
};
this.log.warn(`Starting Tunnel with Options: ${JSON.stringify(options)}`);
Expand Down

0 comments on commit a101b3b

Please sign in to comment.