BAYSHORE_CONFIG_PATH
This commit is contained in:
parent
284999a18e
commit
fcecc8d598
@ -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": {
|
||||||
|
@ -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;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user