From c30981638ecca85ee1032bfccb80672ca363dd0b Mon Sep 17 00:00:00 2001 From: Michael Clark <5285928+MikesGlitch@users.noreply.github.com> Date: Tue, 15 Oct 2024 20:20:42 +0100 Subject: [PATCH] Allowing data dir to be overridden (#480) * allowing data dir to be overridden * release notes * Update load-config.js --- src/load-config.js | 6 +++++- upcoming-release-notes/480.md | 6 ++++++ 2 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 upcoming-release-notes/480.md diff --git a/src/load-config.js b/src/load-config.js index d99ce4211..19696d59d 100644 --- a/src/load-config.js +++ b/src/load-config.js @@ -11,6 +11,11 @@ debug(`project root: '${projectRoot}'`); export const sqlDir = path.join(projectRoot, 'src', 'sql'); let defaultDataDir = fs.existsSync('/data') ? '/data' : projectRoot; + +if (process.env.ACTUAL_DATA_DIR) { + defaultDataDir = process.env.ACTUAL_DATA_DIR; +} + debug(`default data directory: '${defaultDataDir}'`); function parseJSON(path, allowMissing = false) { @@ -135,7 +140,6 @@ const finalConfig = { } : config.upload, }; - debug(`using port ${finalConfig.port}`); debug(`using hostname ${finalConfig.hostname}`); debug(`using data directory ${finalConfig.dataDir}`); diff --git a/upcoming-release-notes/480.md b/upcoming-release-notes/480.md new file mode 100644 index 000000000..bdc690232 --- /dev/null +++ b/upcoming-release-notes/480.md @@ -0,0 +1,6 @@ +--- +category: Enhancements +authors: [MikesGlitch] +--- + +Allow data directory to be overridden by env variable