File tree Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -15,6 +15,7 @@ limitations under the License.
1515*/
1616
1717import * as fs from "fs" ;
18+ import * as path from "path" ;
1819import { load } from "js-yaml" ;
1920import { MatrixClient } from "matrix-bot-sdk" ;
2021
@@ -170,7 +171,10 @@ const defaultConfig: IConfig = {
170171} ;
171172
172173export function read ( ) : IConfig {
173- const content = fs . readFileSync ( `./config/${ process . env . NODE_ENV || 'default' } .yaml` , "utf8" ) ;
174+ const config_dir = process . env . NODE_CONFIG_DIR || "./config" ;
175+ const config_file = `${ process . env . NODE_ENV || "default" } .yaml`
176+
177+ const content = fs . readFileSync ( path . join ( config_dir , config_file ) , "utf8" ) ;
174178 const parsed = load ( content ) ;
175179 const config = { ...defaultConfig , ...( parsed as object ) } as IConfig ;
176180 return config ;
You can’t perform that action at this time.
0 commit comments