fmt
This commit is contained in:
+12
-12
@@ -9,19 +9,19 @@ export * as yup from 'yup'
|
||||
const log = logger('config')
|
||||
|
||||
export async function parse<S extends yup.Maybe<yup.AnyObject>>(schema: yup.ObjectSchema<S>): Promise<Ok<S>> {
|
||||
log.info("Parse from env")
|
||||
log.info('Parse from env')
|
||||
|
||||
log.trace("Start parsing")
|
||||
const config = await parsing.object(schema)
|
||||
if (!config.ok) return config
|
||||
log.trace('Start parsing')
|
||||
const config = await parsing.object(schema)
|
||||
if (!config.ok) return config
|
||||
|
||||
log.trace("double-check")
|
||||
const res = await schema.isValid(config.data, {strict: true})
|
||||
if (!res) {
|
||||
log.error("Double-check failed")
|
||||
log.debug('Config', config.data)
|
||||
return {ok: false}
|
||||
}
|
||||
log.trace('double-check')
|
||||
const res = await schema.isValid(config.data, {strict: true})
|
||||
if (!res) {
|
||||
log.error('Double-check failed')
|
||||
log.debug('Config', config.data)
|
||||
return {ok: false}
|
||||
}
|
||||
|
||||
return config
|
||||
return config
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user