From b376314c4537f723efa9c4772602fe348eb4b255 Mon Sep 17 00:00:00 2001 From: Anand Chowdhary Date: Wed, 14 Oct 2020 02:21:23 +0530 Subject: [PATCH] :bug: Use root config if available --- pre-process.ts | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/pre-process.ts b/pre-process.ts index bbcd8e4..647df30 100644 --- a/pre-process.ts +++ b/pre-process.ts @@ -7,13 +7,22 @@ export const preProcess = async () => { [index: string]: string; }; - const config = safeLoad(await readFile(join(".", ".upptimerc.yml"), "utf8")) as { + let config: { logoUrl?: string; name?: string; introTitle?: string; introMessage?: string; i18n?: { [index: string]: string }; - }; + } = safeLoad(await readFile(join(".", ".upptimerc.yml"), "utf8")) as any; + + try { + const file = await readFile(join("..", "..", ".upptimerc.yml"), "utf8"); + if (file) { + config = safeLoad(file) as any; + console.log("Using root config instead"); + } + } catch (error) {} + config.i18n = { ...i18n, ...config.i18n }; await ensureDir(join(".", "src", "data")); await writeJson(join(".", "src", "data", "config.json"), config);