From 391fa39470eea450248c114b49b58c3ccea25c85 Mon Sep 17 00:00:00 2001 From: Valentin Brandl Date: Tue, 24 Nov 2020 19:06:18 +0100 Subject: [PATCH] Use `config` and `dotenv` over `structopt` --- Cargo.lock | 257 ++++++++++++++++++++++++----------------------------- Cargo.toml | 5 +- 2 files changed, 117 insertions(+), 145 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index c70891f..005f75b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -95,7 +95,7 @@ dependencies = [ "pin-project 1.0.1", "rand", "regex", - "serde", + "serde 1.0.117", "serde_json", "serde_urlencoded 0.6.1", "sha-1", @@ -123,7 +123,7 @@ dependencies = [ "http", "log", "regex", - "serde", + "serde 1.0.117", ] [[package]] @@ -280,7 +280,7 @@ dependencies = [ "mime", "pin-project 1.0.1", "regex", - "serde", + "serde 1.0.117", "serde_json", "serde_urlencoded 0.6.1", "socket2", @@ -315,15 +315,6 @@ dependencies = [ "memchr", ] -[[package]] -name = "ansi_term" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b" -dependencies = [ - "winapi 0.3.8", -] - [[package]] name = "ansi_term" version = "0.12.1" @@ -359,17 +350,6 @@ dependencies = [ "syn", ] -[[package]] -name = "atty" -version = "0.2.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" -dependencies = [ - "hermit-abi", - "libc", - "winapi 0.3.8", -] - [[package]] name = "autocfg" version = "1.0.0" @@ -394,7 +374,7 @@ dependencies = [ "mime", "percent-encoding", "rand", - "serde", + "serde 1.0.117", "serde_json", "serde_urlencoded 0.6.1", ] @@ -562,26 +542,11 @@ checksum = "670ad68c9088c2a963aaa298cb369688cf3f9465ce5e2d4ca10e6e0098a1ce73" dependencies = [ "libc", "num-integer", - "num-traits", + "num-traits 0.2.11", "time 0.1.44", "winapi 0.3.8", ] -[[package]] -name = "clap" -version = "2.33.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5067f5bb2d80ef5d68b4c87db81601f0b75bca627bc2ef76b141d7b846a3c6d9" -dependencies = [ - "ansi_term 0.11.0", - "atty", - "bitflags", - "strsim", - "textwrap", - "unicode-width", - "vec_map", -] - [[package]] name = "cloudabi" version = "0.0.3" @@ -591,6 +556,22 @@ dependencies = [ "bitflags", ] +[[package]] +name = "config" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19b076e143e1d9538dde65da30f8481c2a6c44040edb8e02b9bf1351edb92ce3" +dependencies = [ + "lazy_static", + "nom", + "rust-ini", + "serde 1.0.117", + "serde-hjson", + "serde_json", + "toml", + "yaml-rust", +] + [[package]] name = "console_error_panic_hook" version = "0.1.6" @@ -681,6 +662,12 @@ version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "212d0f5754cb6769937f4501cc0e67f4f4483c8d2c3e1e922ee9edbe4ab4c7c0" +[[package]] +name = "dotenv" +version = "0.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77c90badedccf4105eca100756a0b1289e191f6fcbdadd3cee1d2f614f97da8f" + [[package]] name = "dtoa" version = "0.4.5" @@ -971,6 +958,8 @@ dependencies = [ "actix-web", "badge", "bytes 0.6.0", + "config", + "dotenv", "futures", "git2", "lazy_static", @@ -978,10 +967,9 @@ dependencies = [ "openssl-probe", "reqwest", "ructe", - "serde", + "serde 1.0.117", "serde_derive", "serde_json", - "structopt", "tempfile", "tracing", "tracing-actix-web", @@ -1225,6 +1213,16 @@ dependencies = [ "vcpkg", ] +[[package]] +name = "linked-hash-map" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d262045c5b87c0861b3f004610afd0e2c851e2908d08b6c870cbb9d5f494ecd" +dependencies = [ + "serde 0.8.23", + "serde_test", +] + [[package]] name = "linked-hash-map" version = "0.5.2" @@ -1258,7 +1256,7 @@ dependencies = [ "cfg-if 0.1.10", "generator", "scoped-tls", - "serde", + "serde 1.0.117", "serde_json", ] @@ -1268,7 +1266,7 @@ version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "31e24f1ad8321ca0e8a1e0ac13f23cb668e6f5466c2c57319f6a5cf1cc8e3b1c" dependencies = [ - "linked-hash-map", + "linked-hash-map 0.5.2", ] [[package]] @@ -1418,7 +1416,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3f6ea62e9d81a77cd3ee9a2a5b9b609447857f3d358704331e4ef39eb247fcba" dependencies = [ "autocfg", - "num-traits", + "num-traits 0.2.11", +] + +[[package]] +name = "num-traits" +version = "0.1.43" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92e5113e9fd4cc14ded8e499429f396a20f98c772a47cc8622a736e1ec843c31" +dependencies = [ + "num-traits 0.2.11", ] [[package]] @@ -1600,32 +1607,6 @@ version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "74490b50b9fbe561ac330df47c08f3f33073d2d00c150f719147d7c54522fa1b" -[[package]] -name = "proc-macro-error" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "98e9e4b82e0ef281812565ea4751049f1bdcdfccda7d3f459f2e138a40c08678" -dependencies = [ - "proc-macro-error-attr", - "proc-macro2", - "quote", - "syn", - "version_check 0.9.1", -] - -[[package]] -name = "proc-macro-error-attr" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f5444ead4e9935abd7f27dc51f7e852a0569ac888096d5ec2499470794e2e53" -dependencies = [ - "proc-macro2", - "quote", - "syn", - "syn-mid", - "version_check 0.9.1", -] - [[package]] name = "proc-macro-hack" version = "0.5.19" @@ -1770,7 +1751,7 @@ dependencies = [ "native-tls", "percent-encoding", "pin-project-lite 0.2.0", - "serde", + "serde 1.0.117", "serde_urlencoded 0.7.0", "tokio", "tokio-tls", @@ -1805,6 +1786,12 @@ dependencies = [ "nom", ] +[[package]] +name = "rust-ini" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3e52c148ef37f8c375d49d5a73aa70713125b7f19095948a923f80afdeb22ec2" + [[package]] name = "rustc-demangle" version = "0.1.16" @@ -1894,6 +1881,12 @@ version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" +[[package]] +name = "serde" +version = "0.8.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9dad3f759919b92c3068c696c15c3d17238234498bbdcc80f2c469606f948ac8" + [[package]] name = "serde" version = "1.0.117" @@ -1903,6 +1896,19 @@ dependencies = [ "serde_derive", ] +[[package]] +name = "serde-hjson" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a3a4e0ea8a88553209f6cc6cfe8724ecad22e1acf372793c27d995290fe74f8" +dependencies = [ + "lazy_static", + "linked-hash-map 0.3.0", + "num-traits 0.1.43", + "regex", + "serde 0.8.23", +] + [[package]] name = "serde_derive" version = "1.0.117" @@ -1922,7 +1928,16 @@ checksum = "dcac07dbffa1c65e7f816ab9eba78eb142c6d44410f4eeba1e26e4f5dfa56b95" dependencies = [ "itoa", "ryu", - "serde", + "serde 1.0.117", +] + +[[package]] +name = "serde_test" +version = "0.8.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "110b3dbdf8607ec493c22d5d947753282f3bae73c0f56d322af1e8c78e4c23d5" +dependencies = [ + "serde 0.8.23", ] [[package]] @@ -1933,7 +1948,7 @@ checksum = "9ec5d77e2d4c73717816afac02670d5c4f534ea95ed430442cad02e7a6e32c97" dependencies = [ "dtoa", "itoa", - "serde", + "serde 1.0.117", "url", ] @@ -1946,7 +1961,7 @@ dependencies = [ "form_urlencoded", "itoa", "ryu", - "serde", + "serde 1.0.117", ] [[package]] @@ -2046,7 +2061,7 @@ checksum = "c87a60a40fccc84bef0652345bbbbbe20a605bf5d0ce81719fc476f5c03b50ef" dependencies = [ "proc-macro2", "quote", - "serde", + "serde 1.0.117", "serde_derive", "syn", ] @@ -2060,7 +2075,7 @@ dependencies = [ "base-x", "proc-macro2", "quote", - "serde", + "serde 1.0.117", "serde_derive", "serde_json", "sha1", @@ -2073,36 +2088,6 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "213701ba3370744dcd1a12960caa4843b3d68b4d1c0a5d575e0d65b2ee9d16c0" -[[package]] -name = "strsim" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" - -[[package]] -name = "structopt" -version = "0.3.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "126d630294ec449fae0b16f964e35bf3c74f940da9dca17ee9b905f7b3112eb8" -dependencies = [ - "clap", - "lazy_static", - "structopt-derive", -] - -[[package]] -name = "structopt-derive" -version = "0.4.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "65e51c492f9e23a220534971ff5afc14037289de430e3c83f9daf6a1b6ae91e8" -dependencies = [ - "heck", - "proc-macro-error", - "proc-macro2", - "quote", - "syn", -] - [[package]] name = "syn" version = "1.0.48" @@ -2114,17 +2099,6 @@ dependencies = [ "unicode-xid", ] -[[package]] -name = "syn-mid" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7be3539f6c128a931cf19dcee741c1af532c7fd387baa739c03dd2e96479338a" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - [[package]] name = "tempfile" version = "3.1.0" @@ -2139,15 +2113,6 @@ dependencies = [ "winapi 0.3.8", ] -[[package]] -name = "textwrap" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060" -dependencies = [ - "unicode-width", -] - [[package]] name = "thiserror" version = "1.0.20" @@ -2309,6 +2274,15 @@ dependencies = [ "tokio", ] +[[package]] +name = "toml" +version = "0.5.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75cf45bb0bef80604d001caaec0d09da99611b3c0fd39d3080468875cdb65645" +dependencies = [ + "serde 1.0.117", +] + [[package]] name = "tower-service" version = "0.3.0" @@ -2387,7 +2361,7 @@ version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fb65ea441fbb84f9f6748fd496cf7f63ec9af5bca94dd86456978d055e8eb28b" dependencies = [ - "serde", + "serde 1.0.117", "tracing-core", ] @@ -2397,12 +2371,12 @@ version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a1fa8f0c8f4c594e4fc9debc1990deab13238077271ba84dd853d54902ee3401" dependencies = [ - "ansi_term 0.12.1", + "ansi_term", "chrono", "lazy_static", "matchers", "regex", - "serde", + "serde 1.0.117", "serde_json", "sharded-slab", "smallvec", @@ -2504,12 +2478,6 @@ version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e83e153d1053cbb5a118eeff7fd5be06ed99153f00dbcd8ae310c5fb2b22edc0" -[[package]] -name = "unicode-width" -version = "0.1.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "caaa9d531767d1ff2150b9332433f32a24622147e5ebb1f26409d5da67afd479" - [[package]] name = "unicode-xid" version = "0.2.0" @@ -2543,12 +2511,6 @@ version = "0.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3fc439f2794e98976c88a2a2dafce96b930fe8010b0a256b3c2199a773933168" -[[package]] -name = "vec_map" -version = "0.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05c78687fb1a80548ae3250346c3db86a80a7cdd77bda190189f2d0a0987c81a" - [[package]] name = "vergen" version = "3.1.0" @@ -2600,7 +2562,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1ac64ead5ea5f05873d7c12b545865ca2b8d28adfc50a49b84770a3a97265d42" dependencies = [ "cfg-if 0.1.10", - "serde", + "serde 1.0.117", "serde_json", "wasm-bindgen-macro", ] @@ -2771,3 +2733,12 @@ dependencies = [ "winapi 0.2.8", "winapi-build", ] + +[[package]] +name = "yaml-rust" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "39f0c922f1a334134dc2f7a8b67dc5d25f0735263feec974345ff706bcf20b0d" +dependencies = [ + "linked-hash-map 0.5.2", +] diff --git a/Cargo.toml b/Cargo.toml index 9216eeb..cd6edc9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,6 +10,8 @@ actix-rt = "1.1.1" actix-web = "3.2.0" badge = "0.3.0" bytes = "0.6.0" +config = { version = "0.10.1", features = ["toml"] } +dotenv = "0.15.0" futures = "0.3.8" git2 = "0.13.12" lazy_static = "1.4.0" @@ -19,11 +21,10 @@ reqwest = "0.10.9" serde = "1.0.117" serde_derive = "1.0.103" serde_json = "1.0.59" -structopt = "0.3.20" tracing = "0.1.22" -tracing-subscriber = "0.2.15" tracing-actix-web = "0.2.1" tracing-futures = "0.2.4" +tracing-subscriber = "0.2.15" [build-dependencies] ructe = "0.13.0"