-
Notifications
You must be signed in to change notification settings - Fork 143
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Always uses default value #378
Comments
The problem is actually that
Sorry, I misremembered. That code solves a similar but different problem. |
Experiencing the same issue on // config.js
const config = convict({
env: {
doc: 'The application environment.',
format: ['production', 'development', 'test'],
default: 'development',
env: 'NODE_ENV'
},
host: {
doc: 'Listen host for server',
format: '*',
default: '127.0.0.1',
env: 'HOST'
},
port: {
doc: 'Listen port for server',
format: 'port',
default: 3000,
env: 'PORT'
}
})
module.exports = config
// server.js
const config = require('./config.js')
const hostAtShell = process.env.HOST // this value is correct
const host = config.get('db.host') // Always returns the default 127.0.0.1
console.log(hostAtShell === host) // false |
@Silur Facing the same issue. Did you solve it? |
no, I removed convict from my setup and use |
Looks like my issue has been different. It didn't notice import { config as loadEnv } from 'dotenv'
loadEnv() |
|
Hello There,
I have following example:
When I run my code with
webpack mode --development
(which sets NODE_ENV) and do:console.log(config.get('env'))
it returns always the default value: "production"
console.log(process.env.NODE_ENV)
it return the correct value: "development"
What is wrong here? Shouldnt get convict the value from process.env?
Thanks!
The text was updated successfully, but these errors were encountered: