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:
@@ -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.",
|
||||
|
||||
Reference in New Issue
Block a user