Use USE_HTTPS to compute AP URLs

Instead of relying on cfg(debug_assertions)
This commit is contained in:
Bat
2018-06-26 16:21:58 +02:00
parent f805ec1d53
commit 507d3e6183
6 changed files with 16 additions and 17 deletions
+9
View File
@@ -92,6 +92,15 @@ lazy_static! {
pub static ref USE_HTTPS: bool = env::var("USE_HTTPS").map(|val| val == "1").unwrap_or(true);
}
pub fn ap_url(url: &str) -> String {
let scheme = if *USE_HTTPS {
"https"
} else {
"http"
};
format!("{}://{}", scheme, url)
}
pub mod blog_authors;
pub mod blogs;
pub mod comments;