chore: update readme

This commit is contained in:
Dmitriy Pleshevskiy 2019-12-24 19:37:55 +03:00
parent dd77942e19
commit 6abe819b35
2 changed files with 48 additions and 4 deletions

View file

@ -1,5 +1,7 @@
# itconfig # itconfig
[![Documentation](https://docs.rs/itconfig/badge.svg?version=0.2.3)](https://docs.rs/itconfig)
Easy build a configs from environment variables and use it in globally. Easy build a configs from environment variables and use it in globally.
We recommend you start with the [documentation]. We recommend you start with the [documentation].
@ -12,7 +14,7 @@ We recommend you start with the [documentation].
use dotenv::dotenv; use dotenv::dotenv;
config! { config! {
DATABASE_URL: bool, DEBUG: bool => true,
HOST: String => "127.0.0.1".to_string(), HOST: String => "127.0.0.1".to_string(),
} }
@ -23,5 +25,29 @@ fn main () {
} }
``` ```
## Running tests
```bash
cargo test
```
## Roadmap
* [ ] Add namespace for variables
* [ ] Custom env name
* [ ] Add if condition for feature variables
## License
[MIT] © [Ice Temple](https://github.com/icetemple)
## Contributors
[pleshevskiy](https://github.com/pleshevskiy) (Dmitriy Pleshevskiy) creator, maintainer.
[documentation]: https://docs.rs/itconfig [documentation]: https://docs.rs/itconfig
[MIT]: https://github.com/icetemple/itconfig-rs/blob/master/LICENSE

View file

@ -9,19 +9,37 @@ We recommend you start with the [documentation].
```rust ```rust
#[macro_use] extern crate itconfig; #[macro_use] extern crate itconfig;
use dotenv::dotenv; // use dotenv::dotenv;
config! { config! {
DATABASE_URL: bool, DEBUG: bool => true,
HOST: String => "127.0.0.1".to_string(), HOST: String => "127.0.0.1".to_string(),
} }
fn main () { fn main () {
dotenv().ok(); // dotenv().ok();
cfg::init(); cfg::init();
assert_eq(cfg::HOST(), String::from("127.0.0.1"); assert_eq(cfg::HOST(), String::from("127.0.0.1");
} }
``` ```
## Roadmap
* [ ] Add namespace for variables
* [ ] Custom env name
* [ ] Add if condition for feature variables
## License
[MIT] © [Ice Temple](https://github.com/icetemple)
## Contributors
[pleshevskiy](https://github.com/pleshevskiy) (Dmitriy Pleshevskiy) creator, maintainer.
[documentation]: https://docs.rs/itconfig [documentation]: https://docs.rs/itconfig