Skip to content

Commit

Permalink
🐛 Use root config if available
Browse files Browse the repository at this point in the history
  • Loading branch information
AnandChowdhary committed Oct 13, 2020
1 parent 7bf81ad commit b376314
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions pre-process.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit b376314

Please sign in to comment.