diff --git a/src/env.ts b/src/env.ts index 2d0485c..b9bb5ec 100644 --- a/src/env.ts +++ b/src/env.ts @@ -9,13 +9,16 @@ const FILE_EXT = '__FILE' // Read from env or file export async function read_env(key: string): Promise> { const path = process.env[key + FILE_EXT] - if (path !== undefined) return from_file(path) - else return {ok: true, data: process.env[key]} + if (path !== undefined) { + log.debug(`Read ${key} from a file`) + log.trace('Path :', path) + return from_file(path) + } else { + log.debug(`Read ${key} from env`) + return {ok: true, data: process.env[key]} + } } -async function from_file(path: string): Promise> { - log.debug('Read a key from a file') - log.trace('Path :', path) - +export async function from_file(path: string): Promise> { const content = await get_file_content(path) if (!content.ok) return content @@ -23,7 +26,7 @@ async function from_file(path: string): Promise> { return content } -async function get_file_content(path: string): Promise> { +export async function get_file_content(path: string): Promise> { log.debug('Read file content') log.trace('Path :', path)