(filePath: string, configFromArgs?: Partial<IConfig>, isTest?: boolean)
| 103 | protected readonly _isTest: boolean; |
| 104 | |
| 105 | static fromFile(filePath: string, configFromArgs?: Partial<IConfig>, isTest?: boolean): NodeConfig { |
| 106 | if (!fs.existsSync(filePath)) { |
| 107 | throw new Error(`Load config from file ${filePath} is not exist`); |
| 108 | } |
| 109 | let configFromFile: unknown; |
| 110 | try { |
| 111 | configFromFile = loadFromJsonOrYaml(filePath); |
| 112 | } catch (e) { |
| 113 | logger.error(`failed to load config file, ${e}`); |
| 114 | throw e; |
| 115 | } |
| 116 | |
| 117 | const config = assign(configFromFile, configFromArgs) as IConfig; |
| 118 | return new NodeConfig(config, isTest); |
| 119 | } |
| 120 | |
| 121 | static rebaseWithArgs(config: NodeConfig, configFromArgs?: Partial<IConfig>): NodeConfig { |
| 122 | const _config = assign({}, (config as any)._config, configFromArgs); |
no test coverage detected