Move validity check

This commit is contained in:
Half-Shot 2022-01-06 13:35:17 +00:00
parent 5507c89188
commit 73b2bf77ab
2 changed files with 6 additions and 5 deletions

View File

@ -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();

View File

@ -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;