Skip to content

Commit 625b62c

Browse files
authored
use requested path to configs (#357)
1 parent 9bcb0b7 commit 625b62c

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/config.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ limitations under the License.
1515
*/
1616

1717
import * as fs from "fs";
18+
import * as path from "path";
1819
import { load } from "js-yaml";
1920
import { MatrixClient } from "matrix-bot-sdk";
2021

@@ -170,7 +171,10 @@ const defaultConfig: IConfig = {
170171
};
171172

172173
export 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;

0 commit comments

Comments
 (0)