From fcecc8d598c16bfcec1d5303f0b7710f0b6be04d Mon Sep 17 00:00:00 2001 From: Luna Nightshade Date: Wed, 21 Jun 2023 16:52:33 +0200 Subject: [PATCH] BAYSHORE_CONFIG_PATH --- package.json | 1 + src/config.ts | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 565f206..a2f8787 100644 --- a/package.json +++ b/package.json @@ -9,6 +9,7 @@ "private": false, "scripts": { "dev": "tsc && node dist", + "build": "tsc", "build_protos": "tsc -p ./tsconfig.proto.json" }, "devDependencies": { diff --git a/src/config.ts b/src/config.ts index a694efd..764cf3c 100644 --- a/src/config.ts +++ b/src/config.ts @@ -1,4 +1,5 @@ import fs from 'fs'; +import process from 'process'; export interface ConfigFile { placeId: string; @@ -69,7 +70,10 @@ export class Config { static load() { console.log('Loading config file...'); - let cfg = fs.readFileSync('./config.json', 'utf-8'); + let cfgPath = process.env['BAYSHORE_CONFIG_PATH']; + if (!cfgPath) + cfgPath = './config.json'; + let cfg = fs.readFileSync(cfgPath, 'utf-8'); let json = JSON.parse(cfg); this.cfg = json as ConfigFile; }