Log config files read

This commit is contained in:
Jerko Steiner 2019-03-13 22:18:58 +05:00
parent 6c2728228e
commit 2fb77382c9
2 changed files with 8 additions and 6 deletions

View File

@ -1,15 +1,13 @@
import {ConfigReader} from './ConfigReader' import {ConfigReader} from './ConfigReader'
import {join} from 'path' import {join} from 'path'
import {closeSync, openSync} from 'fs' import {writeFileSync} from 'fs'
describe('ConfigReader', () => { describe('ConfigReader', () => {
beforeAll(() => { beforeAll(() => {
closeSync( writeFileSync(
openSync( join(__dirname, 'test-files', 'package.json'),
join(__dirname, 'test-files', 'package.json'), '{}',
'w',
),
) )
}) })

View File

@ -3,6 +3,7 @@ import {Config} from './Config'
import {findPackageRoot} from '../files/Find' import {findPackageRoot} from '../files/Find'
import {join} from 'path' import {join} from 'path'
import {readFileSync} from 'fs' import {readFileSync} from 'fs'
import {apiLogger} from '../logger'
const isObject = (value: any) => value !== null && typeof value === 'object' const isObject = (value: any) => value !== null && typeof value === 'object'
@ -40,6 +41,7 @@ export class ConfigReader {
} }
continue continue
} }
apiLogger.info('config: Found config file: %s', configFilename)
success += 1 success += 1
} }
} }
@ -50,10 +52,12 @@ export class ConfigReader {
} }
if (filename) { if (filename) {
apiLogger.info('config: Reading extra config file: %s', filename)
this.readFile(filename) this.readFile(filename)
} }
if (env) { if (env) {
apiLogger.info('config: Parsing env variable: %s', this.environment)
this.parse(env) this.parse(env)
} }