MOre on env parsing for k8s

This commit is contained in:
Jackson Harper
2024-01-15 18:36:35 +08:00
parent f3f9f1a210
commit d31d309bc0
4 changed files with 36 additions and 4 deletions

View File

@ -205,11 +205,15 @@ const envParser =
)
}
export function getEnv(): BackendEnv {
interface Dict<T> {
[key: string]: T | undefined
}
export function getEnv(from: Dict<string>): BackendEnv {
// Dotenv parses env file merging into proces.env which is then read into custom struct here.
dotenv.config()
const parse = envParser(process.env)
const parse = envParser(from)
const pg = {
host: parse('PG_HOST'),
port: parseInt(parse('PG_PORT'), 10),