chore: bump version
This commit is contained in:
parent
353937520f
commit
852435058e
2 changed files with 12 additions and 28 deletions
38
README.md
38
README.md
|
@ -2,7 +2,7 @@
|
||||||
[![Build Status](https://travis-ci.org/icetemple/itconfig-rs.svg?branch=master)](https://travis-ci.org/icetemple/itconfig-rs)
|
[![Build Status](https://travis-ci.org/icetemple/itconfig-rs.svg?branch=master)](https://travis-ci.org/icetemple/itconfig-rs)
|
||||||
[![unsafe forbidden](https://img.shields.io/badge/unsafe-forbidden-success.svg)](https://github.com/rust-secure-code/safety-dance/)
|
[![unsafe forbidden](https://img.shields.io/badge/unsafe-forbidden-success.svg)](https://github.com/rust-secure-code/safety-dance/)
|
||||||
[![Documentation](https://docs.rs/itconfig/badge.svg)](https://docs.rs/itconfig)
|
[![Documentation](https://docs.rs/itconfig/badge.svg)](https://docs.rs/itconfig)
|
||||||
[![Crates.io](https://img.shields.io/badge/crates.io-v1.0.1-blue.svg?longCache=true)](https://crates.io/crates/itconfig)
|
[![Crates.io](https://img.shields.io/badge/crates.io-v1.0.3-blue.svg?longCache=true)](https://crates.io/crates/itconfig)
|
||||||
[![Join the chat at https://gitter.im/icetemple/itconfig-rs](https://badges.gitter.im/icetemple/itconfig-rs.svg)](https://gitter.im/icetemple/itconfig-rs?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
[![Join the chat at https://gitter.im/icetemple/itconfig-rs](https://badges.gitter.im/icetemple/itconfig-rs.svg)](https://gitter.im/icetemple/itconfig-rs?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
||||||
|
|
||||||
Easy build a configs from environment variables and use it in globally.
|
Easy build a configs from environment variables and use it in globally.
|
||||||
|
@ -47,10 +47,10 @@ use std::env;
|
||||||
|
|
||||||
config! {
|
config! {
|
||||||
DEBUG: bool => false,
|
DEBUG: bool => false,
|
||||||
|
|
||||||
#[env_name = "APP_HOST"]
|
#[env_name = "APP_HOST"]
|
||||||
HOST: String => "127.0.0.1",
|
HOST: String => "127.0.0.1",
|
||||||
|
|
||||||
DATABASE_URL < (
|
DATABASE_URL < (
|
||||||
"postgres://",
|
"postgres://",
|
||||||
POSTGRES_USERNAME => "user",
|
POSTGRES_USERNAME => "user",
|
||||||
|
@ -61,24 +61,24 @@ config! {
|
||||||
"/",
|
"/",
|
||||||
POSTGRES_DB => "test",
|
POSTGRES_DB => "test",
|
||||||
),
|
),
|
||||||
|
|
||||||
APP {
|
APP {
|
||||||
static BASE_URL => "/api", // &'static str by default
|
static BASE_URL => "/api", // &'static str by default
|
||||||
|
|
||||||
ARTICLE {
|
ARTICLE {
|
||||||
static PER_PAGE: u32 => 15,
|
static PER_PAGE: u32 => 15,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "companies")]
|
#[cfg(feature = "companies")]
|
||||||
COMPANY {
|
COMPANY {
|
||||||
#[env_name = "INSTITUTIONS_PER_PAGE"]
|
#[env_name = "INSTITUTIONS_PER_PAGE"]
|
||||||
static PER_PAGE: u32 => 15,
|
static PER_PAGE: u32 => 15,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
FEATURE {
|
FEATURE {
|
||||||
NEW_MENU: bool => false,
|
NEW_MENU: bool => false,
|
||||||
|
|
||||||
COMPANY {
|
COMPANY {
|
||||||
PROFILE: bool => false,
|
PROFILE: bool => false,
|
||||||
}
|
}
|
||||||
|
@ -89,11 +89,11 @@ fn main () {
|
||||||
// dotenv().expect("dotenv setup to be successful");
|
// dotenv().expect("dotenv setup to be successful");
|
||||||
// or
|
// or
|
||||||
env::set_var("FEATURE_NEW_MENU", "t");
|
env::set_var("FEATURE_NEW_MENU", "t");
|
||||||
|
|
||||||
config::init();
|
config::init();
|
||||||
assert_eq!(config::HOST(), String::from("127.0.0.1"));
|
assert_eq!(config::HOST(), String::from("127.0.0.1"));
|
||||||
assert_eq!(config::DATABASE_URL(), String::from("postgres://user:pass@localhost:5432/test"));
|
assert_eq!(config::DATABASE_URL(), String::from("postgres://user:pass@localhost:5432/test"));
|
||||||
assert_eq!(config::APP:ARTICLE:PER_PAGE(), 15);
|
assert_eq!(config::APP::ARTICLE::PER_PAGE(), 15);
|
||||||
assert_eq!(config::FEATURE::NEW_MENU(), true);
|
assert_eq!(config::FEATURE::NEW_MENU(), true);
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
@ -119,26 +119,10 @@ fn main() {
|
||||||
## Running tests
|
## Running tests
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
cargo test
|
cargo test --all-features
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
## Roadmap
|
|
||||||
|
|
||||||
* [x] Add namespace for variables
|
|
||||||
* [x] Custom env name
|
|
||||||
* [x] Support feature config and other meta directives
|
|
||||||
* [x] Add default value to env if env is not found
|
|
||||||
* [x] Concat env variables to one variable
|
|
||||||
* [x] Add nested namespaces
|
|
||||||
* [x] Support meta for namespaces
|
|
||||||
* [x] Support array type
|
|
||||||
* [x] Rewrite to proc macro
|
|
||||||
* [ ] Support hashmap type
|
|
||||||
* [ ] Support custom env type
|
|
||||||
* [ ] Common configuration for namespace variables
|
|
||||||
|
|
||||||
|
|
||||||
## Available features
|
## Available features
|
||||||
|
|
||||||
* **default** - ["primitives"]
|
* **default** - ["primitives"]
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
[package]
|
[package]
|
||||||
name = "itconfig"
|
name = "itconfig"
|
||||||
version = "1.0.2"
|
version = "1.0.3"
|
||||||
authors = ["Dmitriy Pleshevskiy <dmitriy@ideascup.me>"]
|
authors = ["Dmitriy Pleshevskiy <dmitriy@ideascup.me>"]
|
||||||
description = "Easy build a configs from environment variables and use it in globally."
|
description = "Easy build a configs from environment variables and use it in globally."
|
||||||
categories = ["config", "web-programming"]
|
categories = ["config", "web-programming"]
|
||||||
|
|
Reference in a new issue