From 2921c539f502b872464a8fcf8a0a686d0326e74d Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Sat, 13 Mar 2021 10:46:36 +0100 Subject: Remove travis Signed-off-by: Matthias Beyer --- .travis.yml | 18 ------------------ 1 file changed, 18 deletions(-) delete mode 100644 .travis.yml 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 -- cgit v1.2.3 From 2d779100d8d96307132c90940f42164167db7198 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Sat, 13 Mar 2021 10:48:06 +0100 Subject: Add srht build configuration Signed-off-by: Matthias Beyer --- .builds/debian.yml | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 .builds/debian.yml 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 + -- cgit v1.2.3 From b4c8836149f9389dd162f34ccc76f6141f91b02c Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Sat, 13 Mar 2021 10:52:15 +0100 Subject: Update README Signed-off-by: Matthias Beyer --- README.md | 38 ++++++++------------------------------ 1 file changed, 8 insertions(+), 30 deletions(-) diff --git a/README.md b/README.md index 0025e5d..5cbe37f 100644 --- a/README.md +++ b/README.md @@ -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 -- cgit v1.2.3 From b416544eb5addd651d949acd0f0193d051f212ac Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Thu, 4 Mar 2021 19:49:08 +0100 Subject: Fix test failure As reported in https://github.com/hjson/hjson-rust/issues/23 the issue of the failing tests is the serde_hjson crate. The problem can be prevented (as reported by https://github.com/hjson/hjson-rust/issues/23#issuecomment-775520018) by disabling the default features of the crate (namingly preservation of key order). This commit disables the default features of serde_hjson to fix our tests. Signed-off-by: Matthias Beyer --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 98a1383..f0f75b6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -28,7 +28,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] -- cgit v1.2.3 From e813ecae86371adf50b39a06d89709b1268abae3 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Thu, 4 Mar 2021 20:17:18 +0100 Subject: Fix expected error message Signed-off-by: Matthias Beyer --- tests/errors.rs | 2 +- tests/file_toml.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/errors.rs b/tests/errors.rs index e59608e..47dd050 100644 --- a/tests/errors.rs +++ b/tests/errors.rs @@ -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_toml.rs b/tests/file_toml.rs index b964586..8fbd8a5 100644 --- a/tests/file_toml.rs +++ b/tests/file_toml.rs @@ -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() ) ); -- cgit v1.2.3 From 71adf3d2c2cab44e3dfcc7a728e2e534c68b2b64 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Sat, 13 Mar 2021 11:01:04 +0100 Subject: Update Cargo.toml settings for maintenance fork Signed-off-by: Matthias Beyer --- Cargo.toml | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index f0f75b6..57b72c4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,18 +1,17 @@ [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 "] +authors = ["Ryan Leckey ", + "Matthias Beyer "] categories = ["config"] license = "MIT/Apache-2.0" -[badges] -travis-ci = { repository = "mehcode/config-rs" } - [features] default = ["toml", "json", "yaml", "hjson", "ini"] json = ["serde_json"] -- cgit v1.2.3 From fafa2acdc87b9ea2374bc27b46df180607d1e82f Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Sat, 13 Mar 2021 11:01:38 +0100 Subject: Fix clippy: Use is_empty() instead of comparing to empty string Signed-off-by: Matthias Beyer --- src/env.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/env.rs b/src/env.rs index 0617383..ccf79fe 100644 --- a/src/env.rs +++ b/src/env.rs @@ -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; } -- cgit v1.2.3 From 9f430e86c7bc0dcd9bd6e42cb27bb1e68d68f0dd Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Sat, 13 Mar 2021 11:02:48 +0100 Subject: Add maintenance badge Signed-off-by: Matthias Beyer --- Cargo.toml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Cargo.toml b/Cargo.toml index 57b72c4..a970a89 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -12,6 +12,9 @@ authors = ["Ryan Leckey ", categories = ["config"] license = "MIT/Apache-2.0" +[badges] +maintenance = { status = "actively-developed" } + [features] default = ["toml", "json", "yaml", "hjson", "ini"] json = ["serde_json"] -- cgit v1.2.3 From bd121fa310ac8ab7e76e25eeea5294826f215fcb Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Sat, 13 Mar 2021 11:07:56 +0100 Subject: Fix imports for new crate name Signed-off-by: Matthias Beyer Tested-by: Matthias Beyer --- examples/glob/src/main.rs | 4 ++-- examples/global/src/main.rs | 4 ++-- examples/hierarchical-env/src/main.rs | 2 +- examples/hierarchical-env/src/settings.rs | 2 +- examples/simple/src/main.rs | 2 +- examples/watch/src/main.rs | 4 ++-- tests/datetime.rs | 4 ++-- tests/defaults.rs | 4 ++-- tests/empty.rs | 4 ++-- tests/env.rs | 4 ++-- tests/errors.rs | 4 ++-- tests/file.rs | 4 ++-- tests/file_hjson.rs | 4 ++-- tests/file_ini.rs | 4 ++-- tests/file_json.rs | 4 ++-- tests/file_toml.rs | 4 ++-- tests/file_yaml.rs | 4 ++-- tests/get.rs | 4 ++-- tests/merge.rs | 4 ++-- tests/set.rs | 4 ++-- 20 files changed, 37 insertions(+), 37 deletions(-) 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 = 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}; 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 47dd050..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 { 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 8fbd8a5..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; 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() { -- cgit v1.2.3