chore: bump config version

This commit is contained in:
Aravinth Manivannan 2023-10-15 02:36:07 +05:30
parent 65c3b9ad67
commit 060291d174
No known key found for this signature in database
GPG key ID: F8F50389936984FF
6 changed files with 193 additions and 184 deletions

272
Cargo.lock generated
View file

@ -119,7 +119,7 @@ dependencies = [
"actix-utils", "actix-utils",
"actix-web", "actix-web",
"futures-util", "futures-util",
"serde 1.0.147", "serde",
"serde_json", "serde_json",
"time 0.3.22", "time 0.3.22",
] ]
@ -143,7 +143,7 @@ dependencies = [
"bytestring", "bytestring",
"http", "http",
"regex", "regex",
"serde 1.0.147", "serde",
"tracing", "tracing",
] ]
@ -246,7 +246,7 @@ dependencies = [
"once_cell", "once_cell",
"pin-project-lite", "pin-project-lite",
"regex", "regex",
"serde 1.0.147", "serde",
"serde_json", "serde_json",
"serde_urlencoded", "serde_urlencoded",
"smallvec", "smallvec",
@ -427,12 +427,6 @@ version = "0.3.7"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6b4930d2cb77ce62f89ee5d5289b4ac049559b1c45539271f5ed4fdc7db34545" checksum = "6b4930d2cb77ce62f89ee5d5289b4ac049559b1c45539271f5ed4fdc7db34545"
[[package]]
name = "arrayvec"
version = "0.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "23b62fc65de8e4e7f52534fb52b0f3ed04746ae267519eef2a83941e8085068b"
[[package]] [[package]]
name = "arrayvec" name = "arrayvec"
version = "0.7.4" version = "0.7.4"
@ -456,7 +450,7 @@ version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "616896e05fc0e2649463a93a15183c6a16bf03413a7af88ef1285ddedfa9cda5" checksum = "616896e05fc0e2649463a93a15183c6a16bf03413a7af88ef1285ddedfa9cda5"
dependencies = [ dependencies = [
"num-traits 0.2.15", "num-traits",
] ]
[[package]] [[package]]
@ -504,7 +498,7 @@ dependencies = [
"percent-encoding", "percent-encoding",
"pin-project-lite", "pin-project-lite",
"rand", "rand",
"serde 1.0.147", "serde",
"serde_json", "serde_json",
"serde_urlencoded", "serde_urlencoded",
"tokio", "tokio",
@ -561,7 +555,7 @@ version = "1.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b1f45e9417d87227c7a56d22e471c6206462cba514c7590c09aff4cf6d1ddcad" checksum = "b1f45e9417d87227c7a56d22e471c6206462cba514c7590c09aff4cf6d1ddcad"
dependencies = [ dependencies = [
"serde 1.0.147", "serde",
] ]
[[package]] [[package]]
@ -577,7 +571,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3c2f0dc9a68c6317d884f97cc36cf5a3d20ba14ce404227df55e1af708ab04bc" checksum = "3c2f0dc9a68c6317d884f97cc36cf5a3d20ba14ce404227df55e1af708ab04bc"
dependencies = [ dependencies = [
"arrayref", "arrayref",
"arrayvec 0.7.4", "arrayvec",
"constant_time_eq 0.2.6", "constant_time_eq 0.2.6",
] ]
@ -647,7 +641,7 @@ dependencies = [
"derive_builder", "derive_builder",
"mime", "mime",
"mime_guess", "mime_guess",
"serde 1.0.147", "serde",
"serde_json", "serde_json",
"sha2", "sha2",
"walkdir", "walkdir",
@ -694,15 +688,18 @@ dependencies = [
[[package]] [[package]]
name = "config" name = "config"
version = "0.11.0" version = "0.13.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1b1b9d958c2b1368a663f05538fc1b5975adce1e19f435acceae987aceeeb369" checksum = "d379af7f68bfc21714c6c7dea883544201741d2ce8274bb12fa54f89507f52a7"
dependencies = [ dependencies = [
"async-trait",
"json5",
"lazy_static", "lazy_static",
"nom 5.1.3", "nom",
"pathdiff",
"ron",
"rust-ini", "rust-ini",
"serde 1.0.147", "serde",
"serde-hjson",
"serde_json", "serde_json",
"toml 0.5.11", "toml 0.5.11",
"yaml-rust", "yaml-rust",
@ -917,7 +914,7 @@ version = "0.1.0"
dependencies = [ dependencies = [
"async-trait", "async-trait",
"libmcaptcha", "libmcaptcha",
"serde 1.0.147", "serde",
"serde_json", "serde_json",
"thiserror", "thiserror",
"url", "url",
@ -1041,6 +1038,12 @@ version = "1.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "212d0f5754cb6769937f4501cc0e67f4f4483c8d2c3e1e922ee9edbe4ab4c7c0" checksum = "212d0f5754cb6769937f4501cc0e67f4f4483c8d2c3e1e922ee9edbe4ab4c7c0"
[[package]]
name = "dlv-list"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0688c2a7f92e427f44895cd63841bff7b29f8d7a1648b9e7e07a4a365b2e1257"
[[package]] [[package]]
name = "dotenv" name = "dotenv"
version = "0.15.0" version = "0.15.0"
@ -1053,7 +1056,7 @@ version = "1.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7fcaabb2fef8c910e7f4c7ce9f67a1283a1715879a7c230ca9d6d1ae31f16d91" checksum = "7fcaabb2fef8c910e7f4c7ce9f67a1283a1715879a7c230ca9d6d1ae31f16d91"
dependencies = [ dependencies = [
"serde 1.0.147", "serde",
] ]
[[package]] [[package]]
@ -1368,6 +1371,9 @@ name = "hashbrown"
version = "0.12.3" version = "0.12.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888"
dependencies = [
"ahash 0.7.6",
]
[[package]] [[package]]
name = "hashbrown" name = "hashbrown"
@ -1629,6 +1635,17 @@ dependencies = [
"wasm-bindgen", "wasm-bindgen",
] ]
[[package]]
name = "json5"
version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "96b0db21af676c1ce64250b5f40f3ce2cf27e4e47cb91ed91eb6fe9350b430c1"
dependencies = [
"pest",
"pest_derive",
"serde",
]
[[package]] [[package]]
name = "language-tags" name = "language-tags"
version = "0.3.2" version = "0.3.2"
@ -1662,7 +1679,7 @@ dependencies = [
"idna 0.3.0", "idna 0.3.0",
"mime", "mime",
"native-tls", "native-tls",
"nom 7.1.3", "nom",
"once_cell", "once_cell",
"quoted_printable", "quoted_printable",
"socket2", "socket2",
@ -1670,19 +1687,6 @@ dependencies = [
"tokio-native-tls", "tokio-native-tls",
] ]
[[package]]
name = "lexical-core"
version = "0.7.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6607c62aa161d23d17a9072cc5da0be67cdfc89d3afb1e8d9c842bebc2525ffe"
dependencies = [
"arrayvec 0.5.2",
"bitflags",
"cfg-if",
"ryu",
"static_assertions",
]
[[package]] [[package]]
name = "libc" name = "libc"
version = "0.2.147" version = "0.2.147"
@ -1710,7 +1714,7 @@ dependencies = [
"pretty_env_logger", "pretty_env_logger",
"rand", "rand",
"redis", "redis",
"serde 1.0.147", "serde",
"serde_json", "serde_json",
"tokio", "tokio",
] ]
@ -1836,7 +1840,7 @@ dependencies = [
"rand", "rand",
"rust-embed", "rust-embed",
"sailfish", "sailfish",
"serde 1.0.147", "serde",
"serde_json", "serde_json",
"sqlx", "sqlx",
"tokio", "tokio",
@ -1928,17 +1932,6 @@ version = "1.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e4a24736216ec316047a1fc4252e27dabb04218aa4a3f37c6e7ddbf1f9782b54" checksum = "e4a24736216ec316047a1fc4252e27dabb04218aa4a3f37c6e7ddbf1f9782b54"
[[package]]
name = "nom"
version = "5.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "08959a387a676302eebf4ddbcbc611da04285579f76f88ee0506c63b1a61dd4b"
dependencies = [
"lexical-core",
"memchr",
"version_check",
]
[[package]] [[package]]
name = "nom" name = "nom"
version = "7.1.3" version = "7.1.3"
@ -1960,7 +1953,7 @@ dependencies = [
"num-integer", "num-integer",
"num-iter", "num-iter",
"num-rational", "num-rational",
"num-traits 0.2.15", "num-traits",
] ]
[[package]] [[package]]
@ -1971,7 +1964,7 @@ checksum = "5f6f7833f2cbf2360a6cfd58cd41a53aa7a90bd4c202f5b1c7dd2ed73c57b2c3"
dependencies = [ dependencies = [
"autocfg", "autocfg",
"num-integer", "num-integer",
"num-traits 0.2.15", "num-traits",
] ]
[[package]] [[package]]
@ -1982,8 +1975,8 @@ checksum = "f93ab6289c7b344a8a9f60f88d80aa20032336fe78da341afc91c8a2341fc75f"
dependencies = [ dependencies = [
"autocfg", "autocfg",
"num-integer", "num-integer",
"num-traits 0.2.15", "num-traits",
"serde 1.0.147", "serde",
] ]
[[package]] [[package]]
@ -1997,7 +1990,7 @@ dependencies = [
"libm", "libm",
"num-integer", "num-integer",
"num-iter", "num-iter",
"num-traits 0.2.15", "num-traits",
"rand", "rand",
"smallvec", "smallvec",
"zeroize", "zeroize",
@ -2009,8 +2002,8 @@ version = "0.4.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "02e0d21255c828d6f128a1e41534206671e8c3ea0c62f32291e808dc82cff17d" checksum = "02e0d21255c828d6f128a1e41534206671e8c3ea0c62f32291e808dc82cff17d"
dependencies = [ dependencies = [
"num-traits 0.2.15", "num-traits",
"serde 1.0.147", "serde",
] ]
[[package]] [[package]]
@ -2020,7 +2013,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9" checksum = "225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9"
dependencies = [ dependencies = [
"autocfg", "autocfg",
"num-traits 0.2.15", "num-traits",
] ]
[[package]] [[package]]
@ -2031,7 +2024,7 @@ checksum = "7d03e6c028c5dc5cac6e2dec0efda81fc887605bb3d884578bb6d6bf7514e252"
dependencies = [ dependencies = [
"autocfg", "autocfg",
"num-integer", "num-integer",
"num-traits 0.2.15", "num-traits",
] ]
[[package]] [[package]]
@ -2042,17 +2035,8 @@ checksum = "0638a1c9d0a3c0914158145bc76cff373a75a627e6ecbfb71cbe6f453a5a19b0"
dependencies = [ dependencies = [
"autocfg", "autocfg",
"num-integer", "num-integer",
"num-traits 0.2.15", "num-traits",
"serde 1.0.147", "serde",
]
[[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.15",
] ]
[[package]] [[package]]
@ -2150,6 +2134,16 @@ dependencies = [
"vcpkg", "vcpkg",
] ]
[[package]]
name = "ordered-multimap"
version = "0.4.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ccd746e37177e1711c20dd619a1620f34f5c8b569c53590a72dedd5344d8924a"
dependencies = [
"dlv-list",
"hashbrown 0.12.3",
]
[[package]] [[package]]
name = "parking_lot" name = "parking_lot"
version = "0.11.2" version = "0.11.2"
@ -2204,6 +2198,12 @@ version = "1.0.12"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9f746c4065a8fa3fe23974dd82f15431cc8d40779821001404d10d2e79ca7d79" checksum = "9f746c4065a8fa3fe23974dd82f15431cc8d40779821001404d10d2e79ca7d79"
[[package]]
name = "pathdiff"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8835116a5c179084a830efb3adc117ab007512b535bc1a21c991d3b32a6b44dd"
[[package]] [[package]]
name = "pem-rfc7468" name = "pem-rfc7468"
version = "0.3.1" version = "0.3.1"
@ -2219,6 +2219,51 @@ version = "2.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9b2a4787296e9989611394c33f193f676704af1686e70b8f8033ab5ba9a35a94" checksum = "9b2a4787296e9989611394c33f193f676704af1686e70b8f8033ab5ba9a35a94"
[[package]]
name = "pest"
version = "2.7.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c022f1e7b65d6a24c0dbbd5fb344c66881bc01f3e5ae74a1c8100f2f985d98a4"
dependencies = [
"memchr",
"thiserror",
"ucd-trie",
]
[[package]]
name = "pest_derive"
version = "2.7.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "35513f630d46400a977c4cb58f78e1bfbe01434316e60c37d27b9ad6139c66d8"
dependencies = [
"pest",
"pest_generator",
]
[[package]]
name = "pest_generator"
version = "2.7.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bc9fc1b9e7057baba189b5c626e2d6f40681ae5b6eb064dc7c7834101ec8123a"
dependencies = [
"pest",
"pest_meta",
"proc-macro2",
"quote",
"syn 2.0.38",
]
[[package]]
name = "pest_meta"
version = "2.7.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1df74e9e7ec4053ceb980e7c0c8bd3594e977fde1af91daba9c928e8e8c6708d"
dependencies = [
"once_cell",
"pest",
"sha2",
]
[[package]] [[package]]
name = "phf" name = "phf"
version = "0.10.1" version = "0.10.1"
@ -2317,7 +2362,7 @@ dependencies = [
"bincode", "bincode",
"derive_builder", "derive_builder",
"num", "num",
"serde 1.0.147", "serde",
"sha2", "sha2",
] ]
@ -2329,7 +2374,7 @@ dependencies = [
"bincode", "bincode",
"derive_builder", "derive_builder",
"num", "num",
"serde 1.0.147", "serde",
"sha2", "sha2",
] ]
@ -2542,6 +2587,17 @@ dependencies = [
"winapi", "winapi",
] ]
[[package]]
name = "ron"
version = "0.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "88073939a61e5b7680558e6be56b419e208420c2adb92be54921fa6b72283f1a"
dependencies = [
"base64 0.13.1",
"bitflags",
"serde",
]
[[package]] [[package]]
name = "rsa" name = "rsa"
version = "0.6.1" version = "0.6.1"
@ -2553,7 +2609,7 @@ dependencies = [
"num-bigint-dig", "num-bigint-dig",
"num-integer", "num-integer",
"num-iter", "num-iter",
"num-traits 0.2.15", "num-traits",
"pkcs1", "pkcs1",
"pkcs8", "pkcs8",
"rand_core", "rand_core",
@ -2610,9 +2666,13 @@ dependencies = [
[[package]] [[package]]
name = "rust-ini" name = "rust-ini"
version = "0.13.0" version = "0.18.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3e52c148ef37f8c375d49d5a73aa70713125b7f19095948a923f80afdeb22ec2" checksum = "f6d5f2436026b4f6e79dc829837d467cc7e9a55ee40e750d716713540715a2df"
dependencies = [
"cfg-if",
"ordered-multimap",
]
[[package]] [[package]]
name = "rustc-demangle" name = "rustc-demangle"
@ -2694,7 +2754,7 @@ dependencies = [
"memchr", "memchr",
"proc-macro2", "proc-macro2",
"quote", "quote",
"serde 1.0.147", "serde",
"syn 2.0.38", "syn 2.0.38",
"toml 0.7.8", "toml 0.7.8",
] ]
@ -2796,12 +2856,6 @@ version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3"
[[package]]
name = "serde"
version = "0.8.23"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9dad3f759919b92c3068c696c15c3d17238234498bbdcc80f2c469606f948ac8"
[[package]] [[package]]
name = "serde" name = "serde"
version = "1.0.147" version = "1.0.147"
@ -2811,18 +2865,6 @@ dependencies = [
"serde_derive", "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",
"num-traits 0.1.43",
"regex",
"serde 0.8.23",
]
[[package]] [[package]]
name = "serde_derive" name = "serde_derive"
version = "1.0.147" version = "1.0.147"
@ -2842,7 +2884,7 @@ checksum = "46266871c240a00b8f503b877622fe33430b3c7d963bdc0f2adc511e54a1eae3"
dependencies = [ dependencies = [
"itoa", "itoa",
"ryu", "ryu",
"serde 1.0.147", "serde",
] ]
[[package]] [[package]]
@ -2851,7 +2893,7 @@ version = "0.6.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "96426c9936fd7a0124915f9185ea1d20aa9445cc9821142f0a73bc9207a2e186" checksum = "96426c9936fd7a0124915f9185ea1d20aa9445cc9821142f0a73bc9207a2e186"
dependencies = [ dependencies = [
"serde 1.0.147", "serde",
] ]
[[package]] [[package]]
@ -2863,7 +2905,7 @@ dependencies = [
"form_urlencoded", "form_urlencoded",
"itoa", "itoa",
"ryu", "ryu",
"serde 1.0.147", "serde",
] ]
[[package]] [[package]]
@ -2977,7 +3019,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b4b7922be017ee70900be125523f38bdd644f4f06a1b16e8fa5a8ee8c34bffd4" checksum = "b4b7922be017ee70900be125523f38bdd644f4f06a1b16e8fa5a8ee8c34bffd4"
dependencies = [ dependencies = [
"itertools", "itertools",
"nom 7.1.3", "nom",
"unicode_categories", "unicode_categories",
] ]
@ -3031,7 +3073,7 @@ dependencies = [
"rand", "rand",
"rsa", "rsa",
"rustls", "rustls",
"serde 1.0.147", "serde",
"serde_json", "serde_json",
"sha-1", "sha-1",
"sha2", "sha2",
@ -3061,7 +3103,7 @@ dependencies = [
"once_cell", "once_cell",
"proc-macro2", "proc-macro2",
"quote", "quote",
"serde 1.0.147", "serde",
"serde_json", "serde_json",
"sha2", "sha2",
"sqlx-core", "sqlx-core",
@ -3091,12 +3133,6 @@ dependencies = [
"version_check", "version_check",
] ]
[[package]]
name = "static_assertions"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f"
[[package]] [[package]]
name = "stdweb" name = "stdweb"
version = "0.4.20" version = "0.4.20"
@ -3119,7 +3155,7 @@ checksum = "c87a60a40fccc84bef0652345bbbbbe20a605bf5d0ce81719fc476f5c03b50ef"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"serde 1.0.147", "serde",
"serde_derive", "serde_derive",
"syn 1.0.94", "syn 1.0.94",
] ]
@ -3133,7 +3169,7 @@ dependencies = [
"base-x", "base-x",
"proc-macro2", "proc-macro2",
"quote", "quote",
"serde 1.0.147", "serde",
"serde_derive", "serde_derive",
"serde_json", "serde_json",
"sha1 0.6.1", "sha1 0.6.1",
@ -3157,7 +3193,7 @@ dependencies = [
"parking_lot 0.12.1", "parking_lot 0.12.1",
"phf_shared", "phf_shared",
"precomputed-hash", "precomputed-hash",
"serde 1.0.147", "serde",
] ]
[[package]] [[package]]
@ -3292,7 +3328,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ea9e1b3cf1243ae005d9e74085d4d542f3125458f3a81af210d901dcd7411efd" checksum = "ea9e1b3cf1243ae005d9e74085d4d542f3125458f3a81af210d901dcd7411efd"
dependencies = [ dependencies = [
"itoa", "itoa",
"serde 1.0.147", "serde",
"time-core", "time-core",
"time-macros 0.2.9", "time-macros 0.2.9",
] ]
@ -3421,7 +3457,7 @@ version = "0.5.11"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f4f7f0dd8d50a853a531c426359045b1998f04219d88799810762cd4ad314234" checksum = "f4f7f0dd8d50a853a531c426359045b1998f04219d88799810762cd4ad314234"
dependencies = [ dependencies = [
"serde 1.0.147", "serde",
] ]
[[package]] [[package]]
@ -3430,7 +3466,7 @@ version = "0.7.8"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dd79e69d3b627db300ff956027cc6c3798cef26d22526befdfcd12feeb6d2257" checksum = "dd79e69d3b627db300ff956027cc6c3798cef26d22526befdfcd12feeb6d2257"
dependencies = [ dependencies = [
"serde 1.0.147", "serde",
"serde_spanned", "serde_spanned",
"toml_datetime", "toml_datetime",
"toml_edit", "toml_edit",
@ -3442,7 +3478,7 @@ version = "0.6.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7cda73e2f1397b1262d6dfdcef8aafae14d1de7748d66822d3bfeeb6d03e5e4b" checksum = "7cda73e2f1397b1262d6dfdcef8aafae14d1de7748d66822d3bfeeb6d03e5e4b"
dependencies = [ dependencies = [
"serde 1.0.147", "serde",
] ]
[[package]] [[package]]
@ -3452,7 +3488,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1b5bb770da30e5cbfde35a2d7b9b8a2c4b8ef89548a7a6aeab5c9a576e3e7421" checksum = "1b5bb770da30e5cbfde35a2d7b9b8a2c4b8ef89548a7a6aeab5c9a576e3e7421"
dependencies = [ dependencies = [
"indexmap 2.0.2", "indexmap 2.0.2",
"serde 1.0.147", "serde",
"serde_spanned", "serde_spanned",
"toml_datetime", "toml_datetime",
"winnow", "winnow",
@ -3485,6 +3521,12 @@ version = "1.16.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "497961ef93d974e23eb6f433eb5fe1b7930b659f06d12dec6fc44a8f554c0bba" checksum = "497961ef93d974e23eb6f433eb5fe1b7930b659f06d12dec6fc44a8f554c0bba"
[[package]]
name = "ucd-trie"
version = "0.1.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ed646292ffc8188ef8ea4d1e0e0150fb15a5c2e12ad9b8fc191ae7a8a7f3c4b9"
[[package]] [[package]]
name = "unicase" name = "unicase"
version = "2.6.0" version = "2.6.0"
@ -3558,7 +3600,7 @@ dependencies = [
"form_urlencoded", "form_urlencoded",
"idna 0.4.0", "idna 0.4.0",
"percent-encoding", "percent-encoding",
"serde 1.0.147", "serde",
] ]
[[package]] [[package]]
@ -3580,7 +3622,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d023da39d1fde5a8a3fe1f3e01ca9632ada0a63e9797de55a879d6e2236277be" checksum = "d023da39d1fde5a8a3fe1f3e01ca9632ada0a63e9797de55a879d6e2236277be"
dependencies = [ dependencies = [
"getrandom", "getrandom",
"serde 1.0.147", "serde",
] ]
[[package]] [[package]]
@ -3592,7 +3634,7 @@ dependencies = [
"idna 0.2.3", "idna 0.2.3",
"lazy_static", "lazy_static",
"regex", "regex",
"serde 1.0.147", "serde",
"serde_derive", "serde_derive",
"serde_json", "serde_json",
"url", "url",

View file

@ -41,7 +41,7 @@ tokio = { version = "1.14", features = ["sync"]}
sqlx = { version = "0.5.13", features = [ "runtime-actix-rustls", "postgres", "time", "offline", "mysql"] } sqlx = { version = "0.5.13", features = [ "runtime-actix-rustls", "postgres", "time", "offline", "mysql"] }
argon2-creds = { branch = "master", git = "https://github.com/realaravinth/argon2-creds"} argon2-creds = { branch = "master", git = "https://github.com/realaravinth/argon2-creds"}
#argon2-creds = { version="*", path = "../../argon2-creds/" } #argon2-creds = { version="*", path = "../../argon2-creds/" }
config = "0.11" config = "0.13"
validator = { version = "0.15", features = ["derive"]} validator = { version = "0.15", features = ["derive"]}
derive_builder = "0.11" derive_builder = "0.11"

View file

@ -34,8 +34,7 @@ endef
define run_dev_migrations ## run database migrations define run_dev_migrations ## run database migrations
cd db/db-sqlx-maria/ && \ cd db/db-sqlx-maria/ && \
DATABASE_URL=${MARIA_DATABASE_URL} sqlx migrate run DATABASE_URL=${MARIA_DATABASE_URL} sqlx migrate run cd db/db-sqlx-postgres/ && \
cd db/db-sqlx-postgres/ && \
DATABASE_URL=${POSTGRES_DATABASE_URL} sqlx migrate run DATABASE_URL=${POSTGRES_DATABASE_URL} sqlx migrate run
endef endef
@ -67,11 +66,9 @@ define test_db_sqlx_maria
endef endef
define test_core define test_core
cargo test --no-fail-fast cargo test --no-fail-fast --jobs=4
endef endef
default: frontend ## Build app in debug mode default: frontend ## Build app in debug mode
$(call cache_bust) $(call cache_bust)
cargo build cargo build

View file

@ -42,15 +42,10 @@ duration = 30 # cooldown period in seconds
# This section deals with the database location and how to access it # This section deals with the database location and how to access it
# Please note that at the moment, we have support for only postgresqa. # Please note that at the moment, we have support for only postgresqa.
# Example, if you are Batman, your config would be: # Example, if you are Batman, your config would be:
# hostname = "batcave.org" # url = "postgres://batman:password@batcave.org:5432/batcave"
# port = "5432" # database_type = "postgres"
# username = "batman" # pool = 4
# password = "somereallycomplicatedBatmanpassword" url = "http://example.org" # hack for tests to run successfully
hostname = "localhost"
port = "5432"
username = "postgres"
password = "password"
name = "postgres"
pool = 4 pool = 4
database_type="postgres" # "postgres", "maria" database_type="postgres" # "postgres", "maria"

View file

@ -6,7 +6,7 @@
use std::path::Path; use std::path::Path;
use std::{env, fs}; use std::{env, fs};
use config::{Config, ConfigError, Environment, File}; use config::{Config, ConfigError, Environment, File, ConfigBuilder};
use derive_more::Display; use derive_more::Display;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
@ -57,32 +57,6 @@ impl Server {
} }
} }
//#[derive(Debug, Clone, Deserialize)]
//struct DatabaseBuilder {
// pub port: u32,
// pub hostname: String,
// pub username: String,
// pub password: String,
// pub name: String,
//}
//impl DatabaseBuilder {
// #[cfg(not(tarpaulin_include))]
// fn extract_database_url(url: &Url) -> Self {
// debug!("Database name: {}", url.path());
// let mut path = url.path().split('/');
// path.next();
// let name = path.next().expect("no database name").to_string();
// DatabaseBuilder {
// port: url.port().expect("Enter database port").into(),
// hostname: url.host().expect("Enter database host").to_string(),
// username: url.username().into(),
// password: url.password().expect("Enter database password").into(),
// name,
// }
// }
//}
#[derive(Deserialize, Serialize, Display, PartialEq, Clone, Debug)] #[derive(Deserialize, Serialize, Display, PartialEq, Clone, Debug)]
#[serde(rename_all = "lowercase")] #[serde(rename_all = "lowercase")]
pub enum DBType { pub enum DBType {
@ -132,12 +106,12 @@ pub struct Settings {
#[cfg(not(tarpaulin_include))] #[cfg(not(tarpaulin_include))]
impl Settings { impl Settings {
pub fn new() -> Result<Self, ConfigError> { pub fn new() -> Result<Self, ConfigError> {
let mut s = Config::new(); let mut s = Config::builder();
const CURRENT_DIR: &str = "./config/default.toml"; const CURRENT_DIR: &str = "./config/default.toml";
const ETC: &str = "/etc/mcaptcha/config.toml"; const ETC: &str = "/etc/mcaptcha/config.toml";
s.set("capatcha.enable_stats", true.to_string()) s = s.set_default("capatcha.enable_stats", true.to_string())
.expect("unable to set capatcha.enable_stats default config"); .expect("unable to set capatcha.enable_stats default config");
if let Ok(path) = env::var("MCAPTCHA_CONFIG") { if let Ok(path) = env::var("MCAPTCHA_CONFIG") {
@ -146,7 +120,7 @@ impl Settings {
"Loading config file from {}", "Loading config file from {}",
absolute_path.to_str().unwrap() absolute_path.to_str().unwrap()
); );
s.merge(File::with_name(absolute_path.to_str().unwrap()))?; s = s.add_source(File::with_name(absolute_path.to_str().unwrap()));
} else if Path::new(CURRENT_DIR).exists() { } else if Path::new(CURRENT_DIR).exists() {
let absolute_path = fs::canonicalize(CURRENT_DIR).unwrap(); let absolute_path = fs::canonicalize(CURRENT_DIR).unwrap();
log::info!( log::info!(
@ -154,56 +128,55 @@ impl Settings {
absolute_path.to_str().unwrap() absolute_path.to_str().unwrap()
); );
// merging default config from file // merging default config from file
s.merge(File::with_name(absolute_path.to_str().unwrap()))?; s = s.add_source(File::with_name(absolute_path.to_str().unwrap()));
} else if Path::new(ETC).exists() { } else if Path::new(ETC).exists() {
log::info!("{}", format!("Loading config file from {}", ETC)); log::info!("{}", format!("Loading config file from {}", ETC));
s.merge(File::with_name(ETC))?; s = s.add_source(File::with_name(ETC));
} else { } else {
log::warn!("Configuration file not found"); log::warn!("Configuration file not found");
} }
s.merge(Environment::with_prefix("MCAPTCHA").separator("_"))?; s = s.add_source(Environment::with_prefix("MCAPTCHA").separator("_"));
check_url(&s);
if let Ok(val) = env::var("PORT") { if let Ok(val) = env::var("PORT") {
s.set("server.port", val).unwrap(); s = s.set_override("server.port", val).unwrap();
log::info!("Overriding [server].port with environment variable"); log::info!("Overriding [server].port with environment variable");
} }
match env::var("DATABASE_URL") { match env::var("DATABASE_URL") {
Ok(val) => { Ok(val) => {
let url = Url::parse(&val).expect("couldn't parse Database URL"); let url = Url::parse(&val).expect("couldn't parse Database URL");
s.set("database.url", url.to_string()).unwrap(); s = s.set_override("database.url", url.to_string()).unwrap();
let database_type = DBType::from_url(&url).unwrap(); let database_type = DBType::from_url(&url).unwrap();
s.set("database.database_type", database_type.to_string()) s = s.set_override("database.database_type", database_type.to_string())
.unwrap(); .unwrap();
log::info!("Overriding [database].url and [database].database_type with environment variable"); log::info!("Overriding [database].url and [database].database_type with environment variable");
} }
Err(_e) => { Err(e) => {
set_database_url(&mut s); log::warn!("Couldn't interpret DATABASE_URL: {:?}", e);
} }
} }
// setting default values let mut settings = s.build()?.try_deserialize::<Settings>()?;
settings.check_url();
#[cfg(test)] #[cfg(test)]
s.set("database.pool", 2.to_string()) settings.set_test_defaults();
.expect("Couldn't set database pool count");
Ok(settings)
match s.try_into() {
Ok(val) => Ok(val),
Err(e) => Err(ConfigError::Message(format!("\n\nError: {}. If it says missing fields, then please refer to https://github.com/mCaptcha/mcaptcha#configuration to learn more about how mcaptcha reads configuration\n\n", e))),
} }
// bypass for issue #15701 <https://github.com/rust-lang/rust/issues/15701> for more information
fn set_test_defaults(&mut self) {
self.database.pool = 2;
} }
}
#[cfg(not(tarpaulin_include))] #[cfg(not(tarpaulin_include))]
fn check_url(s: &Config) { fn check_url(&self) {
let url = s Url::parse(&self.source_code).expect("Please enter a URL for source_code in settings");
.get::<String>("source_code") }
.expect("Couldn't access source_code");
Url::parse(&url).expect("Please enter a URL for source_code in settings");
} }
#[cfg(not(tarpaulin_include))] #[cfg(not(tarpaulin_include))]

View file

@ -40,6 +40,7 @@ pub mod pg {
settings.captcha.runners = Some(1); settings.captcha.runners = Some(1);
settings.database.url = url.clone(); settings.database.url = url.clone();
settings.database.database_type = DBType::Postgres; settings.database.database_type = DBType::Postgres;
settings.database.pool = 2;
Data::new(&settings).await Data::new(&settings).await
} }
@ -59,6 +60,7 @@ pub mod maria {
settings.captcha.runners = Some(1); settings.captcha.runners = Some(1);
settings.database.url = url.clone(); settings.database.url = url.clone();
settings.database.database_type = DBType::Maria; settings.database.database_type = DBType::Maria;
settings.database.pool = 2;
Data::new(&settings).await Data::new(&settings).await
} }