1
0
mirror of synced 2024-12-01 01:37:21 +01:00

BAYSHORE_CONFIG_PATH

This commit is contained in:
Luna Nightshade 2023-06-21 16:52:33 +02:00
parent 284999a18e
commit fcecc8d598
2 changed files with 6 additions and 1 deletions

View File

@ -9,6 +9,7 @@
"private": false, "private": false,
"scripts": { "scripts": {
"dev": "tsc && node dist", "dev": "tsc && node dist",
"build": "tsc",
"build_protos": "tsc -p ./tsconfig.proto.json" "build_protos": "tsc -p ./tsconfig.proto.json"
}, },
"devDependencies": { "devDependencies": {

View File

@ -1,4 +1,5 @@
import fs from 'fs'; import fs from 'fs';
import process from 'process';
export interface ConfigFile { export interface ConfigFile {
placeId: string; placeId: string;
@ -69,7 +70,10 @@ export class Config {
static load() { static load() {
console.log('Loading config file...'); 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); let json = JSON.parse(cfg);
this.cfg = json as ConfigFile; this.cfg = json as ConfigFile;
} }