feat(backend): allow to define path to the config file (#838)

Allow to configure where the configuration file is located via the `CONFIG_FILE` environment variable

Co-authored-by: Jules Lefebvre <jules.lefebvre@diabolocom.com>
This commit is contained in:
JulesdeCube
2025-05-19 15:30:06 +02:00
committed by GitHub
parent 18b34e9bf2
commit cfdb29ed4d
3 changed files with 5 additions and 1 deletions

View File

@@ -13,6 +13,7 @@ import { PrismaService } from "src/prisma/prisma.service";
import { stringToTimespan } from "src/utils/date.util";
import { parse as yamlParse } from "yaml";
import { YamlConfig } from "../../prisma/seed/config.seed";
import { CONFIG_FILE } from "src/constants";
/**
* ConfigService extends EventEmitter to allow listening for config updates,
@@ -42,7 +43,7 @@ export class ConfigService extends EventEmitter {
private async loadYamlConfig() {
let configFile: string = "";
try {
configFile = fs.readFileSync("../config.yaml", "utf8");
configFile = fs.readFileSync(CONFIG_FILE, "utf8");
} catch (e) {
this.logger.log(
"Config.yaml is not set. Falling back to UI configuration.",