Merge pull request #963 from benphelps/fix-settings-after-container-update

Fix settings after container update
This commit is contained in:
Jason Fischer 2023-02-18 22:56:53 -08:00 committed by GitHub
commit 45946ddfe1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 18 deletions

View file

@ -1,6 +1,6 @@
/* eslint-disable no-console */
import { join } from "path";
import { existsSync, copyFile, readFileSync, statSync } from "fs";
import { existsSync, copyFile, readFileSync } from "fs";
import yaml from "js-yaml";
@ -32,18 +32,5 @@ export function getSettings() {
const settingsYaml = join(process.cwd(), "config", "settings.yaml");
const fileContents = readFileSync(settingsYaml, "utf8");
let stats;
try {
stats = statSync(settingsYaml);
} catch (e) {
stats = {};
}
const yamlLoaded = yaml.load(fileContents) ?? {};
return {
...yamlLoaded,
isValid: fileContents !== "-\n" && stats.size !== 2 // see https://github.com/benphelps/homepage/pull/609
};
return yaml.load(fileContents) ?? {};
}