mirror of
https://github.com/DI0IK/homepage-plus.git
synced 2025-07-08 14:38:47 +00:00
allow weather apis to use hidden api keys
This commit is contained in:
parent
08afa0b747
commit
5a8defb478
6 changed files with 61 additions and 12 deletions
|
@ -1,5 +1,8 @@
|
|||
import { join } from "path";
|
||||
import { existsSync, copyFile } from "fs";
|
||||
import { promises as fs } from "fs";
|
||||
import path from "path";
|
||||
import yaml from "js-yaml";
|
||||
|
||||
export default function checkAndCopyConfig(config) {
|
||||
const configYaml = join(process.cwd(), "config", config);
|
||||
|
@ -14,3 +17,11 @@ export default function checkAndCopyConfig(config) {
|
|||
});
|
||||
}
|
||||
}
|
||||
|
||||
export async function getSettings() {
|
||||
checkAndCopyConfig("settings.yaml");
|
||||
|
||||
const settingsYaml = path.join(process.cwd(), "config", "settings.yaml");
|
||||
const fileContents = await fs.readFile(settingsYaml, "utf8");
|
||||
return yaml.load(fileContents);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue