Variables are not being assigned/parsed into process.env
iagoccampos opened this issue · 3 comments
iagoccampos commented
I'm probably doing something really wrong, but i can't find what...
import dotenv from 'dotenv'
import dotenvParseVariables from 'dotenv-parse-variables'
let env = dotenv.config()
if (env.error || !env.parsed) throw env.error
env = dotenvParseVariables(env.parsed, { assignToProcessEnv: true, overrideProcessEnv: true })
console.log(process.env)
My .env file:
PORT=3000
JWT_SECRET=token
What I got from process.env:
{
PORT: '3000', // String
JWT_SECRET: 'token'
}
What I expect:
{
PORT: 3000, // Number
JWT_SECRET: 'clinica'
}
What I'm doing wrong?
niftylettuce commented
If you can add a failing test in this repository and submit as a PR that'd be great
Lautenschlager-id commented
titanism commented
You are correct, it will always be a String and cannot be overridden. We assign the variables but you cannot rely on process
unless you parse it each time using this library.