inversitron
Version:
Simple framework based on InversifyJS
23 lines (22 loc) • 907 B
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var fs_1 = require("fs");
var path_1 = require("path");
var process_1 = require("process");
var configFile_1 = require("./configFile");
var fileExt_1 = __importDefault(require("../enums/fileExt"));
function readConfigFile(path) {
if (path === void 0) { path = process_1.cwd(); }
try {
var configFilePath = path_1.join(path, "" + configFile_1.configFileName + fileExt_1.default.json);
var data = fs_1.readFileSync(configFilePath).toString('utf-8');
return JSON.parse(data);
}
catch (err) {
throw new Error("Unable to find " + configFile_1.configFileName + fileExt_1.default.json + " file in " + path);
}
}
exports.default = readConfigFile;