mirror of
https://github.com/mCaptcha/mCaptcha.git
synced 2026-02-11 10:05:41 +00:00
docs use const routes
This commit is contained in:
@@ -98,6 +98,7 @@ pub struct Settings {
|
||||
pub database: Database,
|
||||
pub server: Server,
|
||||
pub pow: Captcha,
|
||||
pub source_code: String,
|
||||
}
|
||||
|
||||
#[cfg(not(tarpaulin_include))]
|
||||
@@ -116,6 +117,8 @@ impl Settings {
|
||||
// TODO change PLACEHOLDER to app name
|
||||
s.merge(Environment::with_prefix("GUARD"))?;
|
||||
|
||||
check_url(&s);
|
||||
|
||||
match env::var("PORT") {
|
||||
Ok(val) => {
|
||||
s.set("server.port", val).unwrap();
|
||||
@@ -138,6 +141,15 @@ impl Settings {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(not(tarpaulin_include))]
|
||||
fn check_url(s: &Config) {
|
||||
let url = s
|
||||
.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))]
|
||||
fn set_from_database_url(s: &mut Config, database_conf: &DatabaseBuilder) {
|
||||
s.set("database.username", database_conf.username.clone())
|
||||
|
||||
Reference in New Issue
Block a user