Override config directory with env var.

Until this change, the config directory was assumed
to be located at '/config'. This patch retains that
default behaviour, but enables users/devs to override
that behaviour by setting the HOMEPAGE_CONFIG_DIR
variable.
This commit is contained in:
Jon Seager 2023-07-10 15:44:43 +01:00
parent 9c0bd8b07a
commit ca396ce96b
No known key found for this signature in database
8 changed files with 28 additions and 24 deletions

View file

@ -2,7 +2,7 @@ import { join } from "path";
import { createHash } from "crypto";
import { readFileSync } from "fs";
import checkAndCopyConfig from "utils/config/config";
import checkAndCopyConfig, { CONF_DIR } from "utils/config/config";
const configs = ["docker.yaml", "settings.yaml", "services.yaml", "bookmarks.yaml", "widgets.yaml"];
@ -15,7 +15,7 @@ function hash(buffer) {
export default async function handler(req, res) {
const hashes = configs.map((config) => {
checkAndCopyConfig(config);
const configYaml = join(process.cwd(), "config", config);
const configYaml = join(CONF_DIR, config);
return hash(readFileSync(configYaml, "utf8"));
});