(directory: string, hier: string[])
| 135 | } |
| 136 | |
| 137 | export function initialize(directory: string, hier: string[]) { |
| 138 | if (hier === null) throw new Error('Must supply a hierarchy array'); |
| 139 | hierarchy = hier.map((x: string) => x.toLowerCase()); |
| 140 | logger.info(`Reading properties from ${directory} with hierarchy ${hierarchy}`); |
| 141 | const endsWith = /\.properties$/; |
| 142 | const propertyFiles = fs.readdirSync(directory).filter(filename => filename.match(endsWith)); |
| 143 | properties = {}; |
| 144 | for (let file of propertyFiles) { |
| 145 | const baseName = file.replace(endsWith, ''); |
| 146 | file = path.join(directory, file); |
| 147 | debug('Reading config from ' + file); |
| 148 | properties[baseName] = parseProperties(fs.readFileSync(file, 'utf8'), file); |
| 149 | } |
| 150 | logger.debug('props.properties = ', properties); |
| 151 | } |
| 152 | |
| 153 | export function reset() { |
| 154 | hierarchy = []; |
nothing calls this directly
no test coverage detected