Comments (6)
I use $env
a lot so as long as we don't lose the feature I'm all up for it. Especially if it simplifies the codebase. It doesn't seem to overcomplicate the API. Only downside I see is that $env
was more explicit to where it gets its values from compared to $param
if you're not too familiar with confidence API.
from confidence.
We use $env
as well because it's more explicit, plus we use criteria for other things like sentry/tracing agent that need to be initialized before any other require()
but are needed in a plugin for biding with server's events, requests, etc
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
from confidence.
@YoannMa Good idea I like it that way too, plus as you mentioned it's still explicit.
from confidence.
If we decide we want to go forward with this, I have a proposal here: #110
I thought that removing $env
left a small gap, so in that proposal I introduced a way to bind criteria to the store, store.bind()
. I think it has some nice upsides, but check out the proposal if you're interested and of course feel free to offer any feedback, concerns, questions. @augnin if you have the time, I am especially interested to hear what you're thinking on all of this.
from confidence.
Worth noting that there was some chatter in hapi hour about this, mostly concerns that removing $env
would make things less explicit than it currently is, and that some folks like having this feature available to them. I would love to at least keep its feature set in parity with $param
, and maintain it as just a special case of $param
.
from confidence.
I agree. If we were to modify this feature, leveraging $param
as @YoannMa mentioned above seems to be the best choice IMO.
from confidence.
Related Issues (20)
- Publish on npm as @hapipal scoped package
- Replace ALCE file format usage in CLI
- Reorganize documentation for org-wide consistency
- Move from yargs to bossy
- Should we remove Confidence.id.generate() and Confidence.id.criteria()? HOT 8
- How to perform logical operations? HOT 6
- Interest in CLI documentation? HOT 2
- Using 0 as default for coerce number returns undefined HOT 4
- Allow pulling values from criteria into store HOT 5
- New maintainer? HOT 6
- Manifest TLS options never work HOT 1
- Either allow matching "$undefined" or any non-falsy criteria value HOT 1
- Add support for environment variables in filters and values
- Remove module from hapi.js organization HOT 5
- Update hapi core modules to namespaced versions.
- Update deps
- Null values when filtering array items HOT 1
- $coerce array HOT 2
- Drop support for node v10 and below HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from confidence.