UNPKG

deth

Version:

Ethereum node focused on Developer Experience

24 lines (23 loc) 781 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const Path_1 = require("../fs/Path"); const config_1 = require("./config"); /** * Loads config from a directory * TODO: * - support autofinding file based only on dir path * - support at least JSON/JS/TS * - typecheck config with iots * - load BN values as strings in JSON */ function loadConfig(fs, path) { const exists = fs.fileExists(path); if (!exists) { throw new Error(`Couldn't load config at ${path}`); } // @todo parse / typecheck config. We can utilize io-ts for that const config = fs.requireFile(path); config.cwd = Path_1.getDirName(path); // set cwd to config path return config_1.getConfigWithDefaults(config); } exports.loadConfig = loadConfig;