Compare commits
1 commit
main
...
config-env
Author | SHA1 | Date | |
---|---|---|---|
d733857145 |
4 changed files with 76 additions and 6 deletions
76
Cargo.lock
generated
76
Cargo.lock
generated
|
@ -904,8 +904,18 @@ version = "0.10.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "0d706e75d87e35569db781a9b5e2416cff1236a47ed380831f959382ccd5f858"
|
checksum = "0d706e75d87e35569db781a9b5e2416cff1236a47ed380831f959382ccd5f858"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"darling_core",
|
"darling_core 0.10.2",
|
||||||
"darling_macro",
|
"darling_macro 0.10.2",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "darling"
|
||||||
|
version = "0.12.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "a06d4a9551359071d1890820e3571252b91229e0712e7c36b08940e603c5a8fc"
|
||||||
|
dependencies = [
|
||||||
|
"darling_core 0.12.2",
|
||||||
|
"darling_macro 0.12.2",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -918,7 +928,21 @@ dependencies = [
|
||||||
"ident_case",
|
"ident_case",
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"strsim",
|
"strsim 0.9.3",
|
||||||
|
"syn",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "darling_core"
|
||||||
|
version = "0.12.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "b443e5fb0ddd56e0c9bfa47dc060c5306ee500cb731f2b91432dd65589a77684"
|
||||||
|
dependencies = [
|
||||||
|
"fnv",
|
||||||
|
"ident_case",
|
||||||
|
"proc-macro2",
|
||||||
|
"quote",
|
||||||
|
"strsim 0.10.0",
|
||||||
"syn",
|
"syn",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -928,7 +952,18 @@ version = "0.10.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "d9b5a2f4ac4969822c62224815d069952656cadc7084fdca9751e6d959189b72"
|
checksum = "d9b5a2f4ac4969822c62224815d069952656cadc7084fdca9751e6d959189b72"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"darling_core",
|
"darling_core 0.10.2",
|
||||||
|
"quote",
|
||||||
|
"syn",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "darling_macro"
|
||||||
|
version = "0.12.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "c0220073ce504f12a70efc4e7cdaea9e9b1b324872e7ad96a208056d7a638b81"
|
||||||
|
dependencies = [
|
||||||
|
"darling_core 0.12.2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn",
|
"syn",
|
||||||
]
|
]
|
||||||
|
@ -949,7 +984,7 @@ version = "0.9.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "a2658621297f2cf68762a6f7dc0bb7e1ff2cfd6583daef8ee0fed6f7ec468ec0"
|
checksum = "a2658621297f2cf68762a6f7dc0bb7e1ff2cfd6583daef8ee0fed6f7ec468ec0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"darling",
|
"darling 0.10.2",
|
||||||
"derive_builder_core",
|
"derive_builder_core",
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
|
@ -962,7 +997,7 @@ version = "0.9.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "2791ea3e372c8495c0bc2033991d76b512cd799d07491fbd6890124db9458bef"
|
checksum = "2791ea3e372c8495c0bc2033991d76b512cd799d07491fbd6890124db9458bef"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"darling",
|
"darling 0.10.2",
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn",
|
"syn",
|
||||||
|
@ -1982,6 +2017,7 @@ dependencies = [
|
||||||
"reqwest",
|
"reqwest",
|
||||||
"serde",
|
"serde",
|
||||||
"serde_json",
|
"serde_json",
|
||||||
|
"serde_with",
|
||||||
"strum",
|
"strum",
|
||||||
"strum_macros",
|
"strum_macros",
|
||||||
"thiserror",
|
"thiserror",
|
||||||
|
@ -3061,6 +3097,28 @@ dependencies = [
|
||||||
"serde",
|
"serde",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "serde_with"
|
||||||
|
version = "1.6.4"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "b44be9227e214a0420707c9ca74c2d4991d9955bae9415a8f93f05cebf561be5"
|
||||||
|
dependencies = [
|
||||||
|
"serde",
|
||||||
|
"serde_with_macros",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "serde_with_macros"
|
||||||
|
version = "1.4.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "e48b35457e9d855d3dc05ef32a73e0df1e2c0fd72c38796a4ee909160c8eeec2"
|
||||||
|
dependencies = [
|
||||||
|
"darling 0.12.2",
|
||||||
|
"proc-macro2",
|
||||||
|
"quote",
|
||||||
|
"syn",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "serial_test"
|
name = "serial_test"
|
||||||
version = "0.5.1"
|
version = "0.5.1"
|
||||||
|
@ -3246,6 +3304,12 @@ version = "0.9.3"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "6446ced80d6c486436db5c078dde11a9f73d42b57fb273121e160b84f63d894c"
|
checksum = "6446ced80d6c486436db5c078dde11a9f73d42b57fb273121e160b84f63d894c"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "strsim"
|
||||||
|
version = "0.10.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "strum"
|
name = "strum"
|
||||||
version = "0.20.0"
|
version = "0.20.0"
|
||||||
|
|
|
@ -37,3 +37,4 @@ jsonwebtoken = "7.2.0"
|
||||||
deser-hjson = "0.1.12"
|
deser-hjson = "0.1.12"
|
||||||
merge = "0.1.0"
|
merge = "0.1.0"
|
||||||
envy = "0.4.2"
|
envy = "0.4.2"
|
||||||
|
serde_with = "1.6.4"
|
||||||
|
|
|
@ -1,7 +1,10 @@
|
||||||
use merge::Merge;
|
use merge::Merge;
|
||||||
use serde::Deserialize;
|
use serde::Deserialize;
|
||||||
|
use serde_with::with_prefix;
|
||||||
use std::net::IpAddr;
|
use std::net::IpAddr;
|
||||||
|
|
||||||
|
with_prefix!(captcha "captcha__");
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, Clone, Merge)]
|
#[derive(Debug, Deserialize, Clone, Merge)]
|
||||||
pub struct Settings {
|
pub struct Settings {
|
||||||
pub(crate) database: Option<DatabaseConfig>,
|
pub(crate) database: Option<DatabaseConfig>,
|
||||||
|
@ -14,6 +17,7 @@ pub struct Settings {
|
||||||
pub(crate) jwt_secret: Option<String>,
|
pub(crate) jwt_secret: Option<String>,
|
||||||
pub(crate) pictrs_url: Option<String>,
|
pub(crate) pictrs_url: Option<String>,
|
||||||
pub(crate) iframely_url: Option<String>,
|
pub(crate) iframely_url: Option<String>,
|
||||||
|
#[serde(flatten, with = "captcha")]
|
||||||
pub(crate) captcha: Option<CaptchaConfig>,
|
pub(crate) captcha: Option<CaptchaConfig>,
|
||||||
pub(crate) email: Option<EmailConfig>,
|
pub(crate) email: Option<EmailConfig>,
|
||||||
pub(crate) setup: Option<SetupConfig>,
|
pub(crate) setup: Option<SetupConfig>,
|
||||||
|
|
|
@ -29,6 +29,7 @@ embed_migrations!();
|
||||||
async fn main() -> Result<(), LemmyError> {
|
async fn main() -> Result<(), LemmyError> {
|
||||||
env_logger::init();
|
env_logger::init();
|
||||||
let settings = Settings::get();
|
let settings = Settings::get();
|
||||||
|
dbg!(&settings.captcha());
|
||||||
|
|
||||||
// Set up the r2d2 connection pool
|
// Set up the r2d2 connection pool
|
||||||
let db_url = match get_database_url_from_env() {
|
let db_url = match get_database_url_from_env() {
|
||||||
|
|
Loading…
Reference in a new issue