From 73b2bf77ab37e39c3fa33ea9785fc5f803c9e385 Mon Sep 17 00:00:00 2001 From: Half-Shot Date: Thu, 6 Jan 2022 13:35:17 +0000 Subject: [PATCH] Move validity check --- src/Bridge.ts | 5 ----- src/Config/Config.ts | 6 ++++++ 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/Bridge.ts b/src/Bridge.ts index 59f47134..866b11cd 100644 --- a/src/Bridge.ts +++ b/src/Bridge.ts @@ -102,11 +102,6 @@ export class Bridge { public async start() { log.info('Starting up'); - if (!this.config.github && !this.config.gitlab && !this.config.jira && !this.config.generic) { - log.error("You haven't configured support for GitHub or GitLab!"); - throw Error('Bridge cannot start -- no connectors are configured'); - } - if (this.config.github) { this.github = new GithubInstance(this.config.github.auth.id, await fs.readFile(this.config.github.auth.privateKeyFile, 'utf-8')); await this.github.start(); diff --git a/src/Config/Config.ts b/src/Config/Config.ts index b1dfa87f..4c354ee5 100644 --- a/src/Config/Config.ts +++ b/src/Config/Config.ts @@ -218,6 +218,12 @@ export class BridgeConfig { this.logging = configData.logging || { level: "info", } + + + if (!this.github && !this.gitlab && !this.jira && !this.generic) { + throw Error("Config is not valid: At least one of GitHub, GitLab, JIRA or generic hooks must be configured"); + } + // TODO: Formalize env support if (env.CFG_QUEUE_MONOLITHIC && ["false", "off", "no"].includes(env.CFG_QUEUE_MONOLITHIC)) { this.queue.monolithic = false;