withoutboats / configure Goto Github PK
View Code? Open in Web Editor NEWconfiguration
configuration
There is envy project, which looks just like configure and I fail to find what makes these two different. Could you, please, compare them?
First of all thanks for this crate, I like it!
The scoping of environment variable names by the name of the struct implementing Configure
is nice in general, but sometimes I want to extract unscoped, global environment variables to use for configuration.
For example it would be convenient to be able to use the same DATABASE_URL
env variable as the diesel cli. What already works is to add a #[configure(name = "")]
annotation to the struct, but then all fields are unscoped.
A straightforward way to implement this would be a new annotation, maybe something like no_prefix
:
#[derive(Deserialize, Debug, Configure)]
struct MyAppName {
host: String, // would be MY_APP_NAME_HOST
#[configure(no_prefix)]
database_url: String, // just DATABASE_URL
}
I mainly have environment variables as a source in mind, but I can imagine this working in other contexts.
If I manage to free up some time I would be willing to document the existing way if there is one, or to implement the new option :)
How do I use configure
in my project?
I take it that this is this crate: https://crates.io/crates/configure
Could you link the repository?
Thanks!
error[E0244]: wrong number of type arguments: expected 1, found 2
--> src\config.rs:8:30
|
8 | #[derive(Debug, Deserialize, Configure)]
| ^^^^^^^^^ expected 1 type argument
any ideas?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.