From a91c3ac20552cdc215a2427e3fff5b132434e086 Mon Sep 17 00:00:00 2001 From: Federico Builes Date: Mon, 19 Sep 2022 17:28:44 +0200 Subject: [PATCH] Split reading inline/external configuration options. --- src/config.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/config.ts b/src/config.ts index efcc7ea..6dcf8ce 100644 --- a/src/config.ts +++ b/src/config.ts @@ -13,6 +13,15 @@ function getOptionalInput(name: string): string | undefined { } export function readConfig(): ConfigurationOptions { + const hasExternalConfig = getOptionalInput('config-file') + if (hasExternalConfig !== undefined) { + return readConfigFile(CONFIG_FILEPATH) + } else { + return readInlineConfig() + } +} + +export function readInlineConfig(): ConfigurationOptions { const fail_on_severity = z .enum(SEVERITIES) .default('low')