[backend] Add support for a second config file containing secrets

This is required for some packaging scenarios
This commit is contained in:
Laura Hausmann 2023-11-25 03:03:47 +01:00
parent 5490137f44
commit 026538f8a1
No known key found for this signature in database
GPG key ID: D044E84C5BE01605

View file

@ -16,6 +16,7 @@ export default function load() {
const dir = `${_dirname}/../../../..`; const dir = `${_dirname}/../../../..`;
const { const {
ICESHRIMP_CONFIG: configFile, ICESHRIMP_CONFIG: configFile,
ICESHRIMP_SECRETS: secretsFile,
ICESHRIMP_MEDIA_DIR: mediaDir, ICESHRIMP_MEDIA_DIR: mediaDir,
} = process.env; } = process.env;
@ -33,7 +34,9 @@ export default function load() {
"utf-8", "utf-8",
), ),
); );
const config = yaml.load(fs.readFileSync(path, "utf-8")) as Source; let config = yaml.load(fs.readFileSync(path, "utf-8")) as Source;
if (secretsFile !== undefined)
config = Object.assign(config, yaml.load(fs.readFileSync(secretsFile, "utf-8")) as Source);
const mixin = {} as Mixin; const mixin = {} as Mixin;