diff options
author | Matthias Beyer <mail@beyermatthias.de> | 2021-03-13 11:11:21 +0100 |
---|---|---|
committer | Matthias Beyer <mail@beyermatthias.de> | 2021-03-13 11:11:21 +0100 |
commit | ba7090f173aed83f3fa85f985c2732f4b97c6172 (patch) | |
tree | b9ebd8f7fd7ce7e4b6c13f24d63a3e756f410174 | |
parent | bf09a730d44cb72f483dab04163dd75f2b9d1746 (diff) | |
parent | bd121fa310ac8ab7e76e25eeea5294826f215fcb (diff) |
Merge branch 'srht-builds'
-rw-r--r-- | .builds/debian.yml | 24 | ||||
-rw-r--r-- | .travis.yml | 18 | ||||
-rw-r--r-- | Cargo.toml | 16 | ||||
-rw-r--r-- | README.md | 38 | ||||
-rw-r--r-- | examples/glob/src/main.rs | 4 | ||||
-rw-r--r-- | examples/global/src/main.rs | 4 | ||||
-rw-r--r-- | examples/hierarchical-env/src/main.rs | 2 | ||||
-rw-r--r-- | examples/hierarchical-env/src/settings.rs | 2 | ||||
-rw-r--r-- | examples/simple/src/main.rs | 2 | ||||
-rw-r--r-- | examples/watch/src/main.rs | 4 | ||||
-rw-r--r-- | src/env.rs | 2 | ||||
-rw-r--r-- | tests/datetime.rs | 4 | ||||
-rw-r--r-- | tests/defaults.rs | 4 | ||||
-rw-r--r-- | tests/empty.rs | 4 | ||||
-rw-r--r-- | tests/env.rs | 4 | ||||
-rw-r--r-- | tests/errors.rs | 6 | ||||
-rw-r--r-- | tests/file.rs | 4 | ||||
-rw-r--r-- | tests/file_hjson.rs | 4 | ||||
-rw-r--r-- | tests/file_ini.rs | 4 | ||||
-rw-r--r-- | tests/file_json.rs | 4 | ||||
-rw-r--r-- | tests/file_toml.rs | 6 | ||||
-rw-r--r-- | tests/file_yaml.rs | 4 | ||||
-rw-r--r-- | tests/get.rs | 4 | ||||
-rw-r--r-- | tests/merge.rs | 4 | ||||
-rw-r--r-- | tests/set.rs | 4 |
25 files changed, 81 insertions, 95 deletions
diff --git a/.builds/debian.yml b/.builds/debian.yml new file mode 100644 index 0000000..5fb602e --- /dev/null +++ b/.builds/debian.yml @@ -0,0 +1,24 @@ +image: debian/buster +sources: + - https://git.sr.ht/~matthiasbeyer/config-rs-maint +tasks: + - install: curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain 1.50.0 + - build: | + cd config-rs-maint + PATH="$HOME/.cargo/bin:$PATH" cargo build --all --all-features + - test: | + cd config-rs-maint + PATH="$HOME/.cargo/bin:$PATH" cargo test --all --all-features + - clippy: | + cd config-rs-maint + PATH="$HOME/.cargo/bin:$PATH" rustup component add clippy + PATH="$HOME/.cargo/bin:$PATH" cargo clippy --all --all-targets --all-features -- -D warnings + - fmt: | + cd config-rs-maint + PATH="$HOME/.cargo/bin:$PATH" rustup component add rustfmt + PATH="$HOME/.cargo/bin:$PATH" cargo fmt -- --check +triggers: + - action: email + condition: always + to: mail@beyermatthias.de + diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index b7bd102..0000000 --- a/.travis.yml +++ /dev/null @@ -1,18 +0,0 @@ -sudo: true -language: rust -cache: cargo -rust: - - nightly - - beta - - stable - -matrix: - allow_failures: - - rust: nightly - -before_script: - - rustup component add rustfmt - -script: - - cargo test - - cargo fmt -- --check @@ -1,17 +1,19 @@ [package] -name = "config" +name = "config-maint" version = "0.10.1" -description = "Layered configuration system for Rust applications." -homepage = "https://github.com/mehcode/config-rs" -repository = "https://github.com/mehcode/config-rs" +description = "Layered configuration system for Rust applications. (Maintenance fork)" +homepage = "https://sr.ht/~matthiasbeyer/config-rs-maint/" +repository = "https://git.sr.ht/~matthiasbeyer/config-rs-maint/" +documentation = "https://docs.rs/config-maint" readme = "README.md" keywords = ["config", "configuration", "settings", "env", "environment"] -authors = ["Ryan Leckey <leckey.ryan@gmail.com>"] +authors = ["Ryan Leckey <leckey.ryan@gmail.com>", + "Matthias Beyer <mail@beyermatthias.de>"] categories = ["config"] license = "MIT/Apache-2.0" [badges] -travis-ci = { repository = "mehcode/config-rs" } +maintenance = { status = "actively-developed" } [features] default = ["toml", "json", "yaml", "hjson", "ini"] @@ -28,7 +30,7 @@ nom = "5.0.0" toml = { version = "0.5", optional = true } serde_json = { version = "1.0.2", optional = true } yaml-rust = { version = "0.4", optional = true } -serde-hjson = { version = "0.9", optional = true } +serde-hjson = { version = "0.9", default-features = false, optional = true } rust-ini = { version = "0.13", optional = true } [dev-dependencies] @@ -1,41 +1,19 @@ -# config-rs -![Rust](https://img.shields.io/badge/rust-stable-brightgreen.svg) -[![Build Status](https://travis-ci.org/mehcode/config-rs.svg?branch=master)](https://travis-ci.org/mehcode/config-rs) -[![Crates.io](https://img.shields.io/crates/d/config.svg)](https://crates.io/crates/config) -[![Docs.rs](https://docs.rs/config/badge.svg)](https://docs.rs/config) +# config-rs-maint > Layered configuration system for Rust applications (with strong support for [12-factor] applications). -[12-factor]: https://12factor.net/config - - Set defaults - - Set explicit values (to programmatically override) - - Read from [JSON], [TOML], [YAML], [HJSON], [INI] files - - Read from environment - - Loosely typed — Configuration values may be read in any supported type, as long as there exists a reasonable conversion - - Access nested fields using a formatted path — Uses a subset of JSONPath; currently supports the child ( `redis.port` ) and subscript operators ( `databases[0].name` ) +## Note -[JSON]: https://github.com/serde-rs/json -[TOML]: https://github.com/toml-lang/toml -[YAML]: https://github.com/chyh1990/yaml-rust -[HJSON]: https://github.com/hjson/hjson-rust -[INI]: https://github.com/zonyitoo/rust-ini +This is a maintenance fork of [config-rs](https://github.com/mehcode/config-rs/) +because the upstream maintainer(s) are unresponsive. -## Usage +I will maintain this fork as I see fit, but contributions are welcome. +Bugfixes and new features are explicitely welcome here. -```toml -[dependencies] -config = "0.10" -``` +As soon as upstream is responsive again, I hope I can work with them to include +all patches landed here into upstream. - - `ini` - Adds support for reading INI files - - `json` - Adds support for reading JSON files - - `hjson` - Adds support for reading HJSON files - - `yaml` - Adds support for reading YAML files - - `toml` - Adds support for reading TOML files - -See the [documentation](https://docs.rs/config) or [examples](https://github.com/mehcode/config-rs/tree/master/examples) for -more usage information. ## License diff --git a/examples/glob/src/main.rs b/examples/glob/src/main.rs index 112335c..e653b77 100644 --- a/examples/glob/src/main.rs +++ b/examples/glob/src/main.rs @@ -1,9 +1,9 @@ extern crate glob; -extern crate config; +extern crate config_maint; use std::path::Path; use std::collections::HashMap; -use config::*; +use config_maint::*; use glob::glob; fn main() { diff --git a/examples/global/src/main.rs b/examples/global/src/main.rs index 8e0e068..f338e84 100644 --- a/examples/global/src/main.rs +++ b/examples/global/src/main.rs @@ -1,11 +1,11 @@ #[macro_use] extern crate lazy_static; -extern crate config; +extern crate config_maint; use std::error::Error; use std::sync::RwLock; -use config::Config; +use config_maint::Config; lazy_static! { static ref SETTINGS: RwLock<Config> = RwLock::new(Config::default()); diff --git a/examples/hierarchical-env/src/main.rs b/examples/hierarchical-env/src/main.rs index 65f727d..0897fe1 100644 --- a/examples/hierarchical-env/src/main.rs +++ b/examples/hierarchical-env/src/main.rs @@ -1,4 +1,4 @@ -extern crate config; +extern crate config_maint; extern crate serde; #[macro_use] diff --git a/examples/hierarchical-env/src/settings.rs b/examples/hierarchical-env/src/settings.rs index ad23163..a341a21 100644 --- a/examples/hierarchical-env/src/settings.rs +++ b/examples/hierarchical-env/src/settings.rs @@ -1,5 +1,5 @@ use std::env; -use config::{ConfigError, Config, File, Environment}; +use config_maint::{ConfigError, Config, File, Environment}; #[derive(Debug, Deserialize)] struct Database { diff --git a/examples/simple/src/main.rs b/examples/simple/src/main.rs index 7e7ca31..1a4fcd4 100644 --- a/examples/simple/src/main.rs +++ b/examples/simple/src/main.rs @@ -1,4 +1,4 @@ -extern crate config; +extern crate config_maint; use std::collections::HashMap; diff --git a/examples/watch/src/main.rs b/examples/watch/src/main.rs index 3f08e94..91391e0 100644 --- a/examples/watch/src/main.rs +++ b/examples/watch/src/main.rs @@ -1,10 +1,10 @@ -extern crate config; +extern crate config_maint; extern crate notify; #[macro_use] extern crate lazy_static; -use config::*; +use config_maint::*; use std::collections::HashMap; use std::sync::RwLock; use notify::{RecommendedWatcher, DebouncedEvent, Watcher, RecursiveMode}; @@ -84,7 +84,7 @@ impl Source for Environment { for (key, value) in env::vars() { // Treat empty environment variables as unset - if self.ignore_empty && value == "" { + if self.ignore_empty && value.is_empty() { continue; } diff --git a/tests/datetime.rs b/tests/datetime.rs index 6c1e620..9c18264 100644 --- a/tests/datetime.rs +++ b/tests/datetime.rs @@ -7,10 +7,10 @@ ))] extern crate chrono; -extern crate config; +extern crate config_maint; use chrono::{DateTime, TimeZone, Utc}; -use config::*; +use config_maint::*; fn make() -> Config { Config::default() diff --git a/tests/defaults.rs b/tests/defaults.rs index 8d863ae..c50dd65 100644 --- a/tests/defaults.rs +++ b/tests/defaults.rs @@ -1,9 +1,9 @@ -extern crate config; +extern crate config_maint; #[macro_use] extern crate serde_derive; -use config::*; +use config_maint::*; #[derive(Debug, Serialize, Deserialize)] #[serde(default)] diff --git a/tests/empty.rs b/tests/empty.rs index 1f56d38..92d3384 100644 --- a/tests/empty.rs +++ b/tests/empty.rs @@ -1,9 +1,9 @@ -extern crate config; +extern crate config_maint; #[macro_use] extern crate serde_derive; -use config::*; +use config_maint::*; #[derive(Debug, Serialize, Deserialize)] struct Settings { diff --git a/tests/env.rs b/tests/env.rs index bb1a1ec..fd440ef 100644 --- a/tests/env.rs +++ b/tests/env.rs @@ -1,6 +1,6 @@ -extern crate config; +extern crate config_maint; -use config::*; +use config_maint::*; use std::env; #[test] diff --git a/tests/errors.rs b/tests/errors.rs index e59608e..ec96c98 100644 --- a/tests/errors.rs +++ b/tests/errors.rs @@ -1,11 +1,11 @@ #![cfg(feature = "toml")] -extern crate config; +extern crate config_maint; #[macro_use] extern crate serde_derive; -use config::*; +use config_maint::*; use std::path::PathBuf; fn make() -> Config { @@ -27,7 +27,7 @@ fn test_error_parse() { assert_eq!( res.unwrap_err().to_string(), format!( - "failed to parse datetime for key `error` at line 2 column 9 in {}", + "invalid TOML value, did you mean to use a quoted string? at line 2 column 9 in {}", path.display() ) ); diff --git a/tests/file.rs b/tests/file.rs index 0680c2a..e9ee31c 100644 --- a/tests/file.rs +++ b/tests/file.rs @@ -1,8 +1,8 @@ #![cfg(feature = "yaml")] -extern crate config; +extern crate config_maint; -use config::*; +use config_maint::*; #[test] fn test_file_not_required() { diff --git a/tests/file_hjson.rs b/tests/file_hjson.rs index 87318eb..b866dd6 100644 --- a/tests/file_hjson.rs +++ b/tests/file_hjson.rs @@ -1,13 +1,13 @@ #![cfg(feature = "hjson")] -extern crate config; +extern crate config_maint; extern crate float_cmp; extern crate serde; #[macro_use] extern crate serde_derive; -use config::*; +use config_maint::*; use float_cmp::ApproxEqUlps; use std::collections::HashMap; use std::path::PathBuf; diff --git a/tests/file_ini.rs b/tests/file_ini.rs index 088eb2c..a54f0fe 100644 --- a/tests/file_ini.rs +++ b/tests/file_ini.rs @@ -1,13 +1,13 @@ #![cfg(feature = "ini")] -extern crate config; +extern crate config_maint; extern crate float_cmp; extern crate serde; #[macro_use] extern crate serde_derive; -use config::*; +use config_maint::*; use std::path::PathBuf; #[derive(Debug, Deserialize, PartialEq)] diff --git a/tests/file_json.rs b/tests/file_json.rs index 307312e..0dfeffe 100644 --- a/tests/file_json.rs +++ b/tests/file_json.rs @@ -1,13 +1,13 @@ #![cfg(feature = "json")] -extern crate config; +extern crate config_maint; extern crate float_cmp; extern crate serde; #[macro_use] extern crate serde_derive; -use config::*; +use config_maint::*; use float_cmp::ApproxEqUlps; use std::collections::HashMap; use std::path::PathBuf; diff --git a/tests/file_toml.rs b/tests/file_toml.rs index b964586..7591c20 100644 --- a/tests/file_toml.rs +++ b/tests/file_toml.rs @@ -1,13 +1,13 @@ #![cfg(feature = "toml")] -extern crate config; +extern crate config_maint; extern crate float_cmp; extern crate serde; #[macro_use] extern crate serde_derive; -use config::*; +use config_maint::*; use float_cmp::ApproxEqUlps; use std::collections::HashMap; use std::path::PathBuf; @@ -86,7 +86,7 @@ fn test_error_parse() { assert_eq!( res.unwrap_err().to_string(), format!( - "failed to parse datetime for key `error` at line 2 column 9 in {}", + "invalid TOML value, did you mean to use a quoted string? at line 2 column 9 in {}", path_with_extension.display() ) ); diff --git a/tests/file_yaml.rs b/tests/file_yaml.rs index 59174e6..41b495c 100644 --- a/tests/file_yaml.rs +++ b/tests/file_yaml.rs @@ -1,13 +1,13 @@ #![cfg(feature = "yaml")] -extern crate config; +extern crate config_maint; extern crate float_cmp; extern crate serde; #[macro_use] extern crate serde_derive; -use config::*; +use config_maint::*; use float_cmp::ApproxEqUlps; use std::collections::HashMap; use std::path::PathBuf; diff --git a/tests/get.rs b/tests/get.rs index 10ec066..135d3b0 100644 --- a/tests/get.rs +++ b/tests/get.rs @@ -1,13 +1,13 @@ #![cfg(feature = "toml")] -extern crate config; +extern crate config_maint; extern crate float_cmp; extern crate serde; #[macro_use] extern crate serde_derive; -use config::*; +use config_maint::*; use float_cmp::ApproxEqUlps; use std::collections::{HashMap, HashSet}; diff --git a/tests/merge.rs b/tests/merge.rs index 1be7db1..5ac13c4 100644 --- a/tests/merge.rs +++ b/tests/merge.rs @@ -1,8 +1,8 @@ #![cfg(feature = "toml")] -extern crate config; +extern crate config_maint; -use config::*; +use config_maint::*; fn make() -> Config { let mut c = Config::default(); diff --git a/tests/set.rs b/tests/set.rs index ac8d5c9..9defef5 100644 --- a/tests/set.rs +++ b/tests/set.rs @@ -1,6 +1,6 @@ -extern crate config; +extern crate config_maint; -use config::*; +use config_maint::*; #[test] fn test_set_scalar() { |