Skip to content

Commit

Permalink
🐛 Read correct .upptimerc.yml file
Browse files Browse the repository at this point in the history
  • Loading branch information
AnandChowdhary committed Oct 28, 2020
1 parent 52f659f commit d9c5cc9
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 12 deletions.
2 changes: 1 addition & 1 deletion post-process.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export const postProcess = async () => {
cname?: string;
baseUrl?: string;
};
} = safeLoad(await readFile(join("..", "..", ".upptimerc.yml"), "utf8")) as any;
} = safeLoad(await readFile(join("..", ".upptimerc.yml"), "utf8")) as any;
const baseUrl = (config["status-website"] || {}).baseUrl || "/";

execSync(`sapper export --legacy --basepath ${baseUrl}`, {
Expand Down
2 changes: 1 addition & 1 deletion pre-process.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export const preProcess = async () => {
introTitle?: string;
introMessage?: string;
i18n?: { [index: string]: string };
} = safeLoad(await readFile(join("..", "..", ".upptimerc.yml"), "utf8")) as any;
} = safeLoad(await readFile(join("..", ".upptimerc.yml"), "utf8")) as any;

config.i18n = { ...i18n, ...config.i18n };
await ensureDir(join(".", "src", "data"));
Expand Down
11 changes: 1 addition & 10 deletions src/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,7 @@ import { join } from "path";
const { PORT, NODE_ENV } = process.env;
const dev = NODE_ENV === "development";

let config = safeLoad(fs.readFileSync(join(".", ".upptimerc.yml"), "utf8"));
try {
const file = fs.readFileSync(join("..", "..", ".upptimerc.yml"), "utf8");
if (file) {
config = safeLoad(file);
console.log("Using root config instead", config);
}
} catch (error) {
console.log("Root config not found 2 dirs up");
}
let config = safeLoad(fs.readFileSync(join("..", ".upptimerc.yml"), "utf8"));
const baseUrl = (config["status-website"] || {}).baseUrl || "/";

polka()
Expand Down

0 comments on commit d9c5cc9

Please sign in to comment.