-
Notifications
You must be signed in to change notification settings - Fork 44
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
Should we remove $env? #106
Comments
I use |
We use It would not be a deal breaker thought, we could just do : const store = new Confidence.Store({
server: {
host: 'localhost',
port: {
$param: 'env.PORT',
$coerce: 'number',
$default: 3000
},
debug: {
$filter: 'env.NODE_ENV',
$default: {
log: ['error'],
request: ['error']
},
production: {
request: ['implementation']
}
}
}
});
const config = store.get('/', { env : process.env, other: 'things' }); Bonus point for still being explicit enough too |
@YoannMa Good idea I like it that way too, plus as you mentioned it's still explicit. |
If we decide we want to go forward with this, I have a proposal here: #110 I thought that removing |
Worth noting that there was some chatter in hapi hour about this, mostly concerns that removing |
I agree. If we were to modify this feature, leveraging |
I noticed that
$env
can be modeled equally well using$param
if the user passesprocess.env
in their criteria. I propose that in v6 we remove$env
and encourage users to explicitly pass the environment as criteria if that is their intention. I am in favor of this change because it simplifies the API, and encourages the store to not rely on any implicit/global state.I just made a small alteration to allow
$coerce
to work with$param
to generate this example:Before (with
$env
)After (with
$param
)The text was updated successfully, but these errors were encountered: