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 29, 2023
1 parent e2c93e0 commit 42db750
Showing 1 changed file with 15 additions and 10 deletions.
25 changes: 15 additions & 10 deletions src/platform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,16 +88,21 @@ 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.hostname) {
this.debugLog(`URL: ${this.config.url}`);
this.debugLog(`Hostname: ${this.config.hostname}`);
throw new Error('Cannot have both url and hostname in config. Please remove one.');
try {
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.hostname) {
this.debugLog(`URL: ${this.config.url}`);
this.debugLog(`Hostname: ${this.config.hostname}`);
throw new Error('Cannot have both url and hostname in config. Please remove one.');
}
} catch (e: any) {
this.errorLog(JSON.stringify(e.message));
this.debugLog(JSON.stringify(e));
}
if (!this.config.logging) {
this.config.logging = 'standard';
Expand Down

0 comments on commit 42db750

Please sign in to comment.