30 lines
956 B
Rust
30 lines
956 B
Rust
use crate::AppConfig;
|
|
|
|
impl AppConfig {
|
|
pub fn main_domain(&self) -> anyhow::Result<String> {
|
|
if let Some(domain_url) = self.env.get("APP_DOMAIN_URL") {
|
|
return Ok(domain_url.to_string());
|
|
}
|
|
Ok("http://127.0.0.1".to_string())
|
|
}
|
|
|
|
pub fn static_domain(&self) -> anyhow::Result<String> {
|
|
if let Some(static_domain) = self.env.get("APP_STATIC_DOMAIN") {
|
|
return Ok(static_domain.to_string());
|
|
}
|
|
self.main_domain()
|
|
}
|
|
pub fn media_domain(&self) -> anyhow::Result<String> {
|
|
if let Some(media_domain) = self.env.get("APP_MEDIA_DOMAIN") {
|
|
return Ok(media_domain.to_string());
|
|
}
|
|
self.main_domain()
|
|
}
|
|
pub fn git_http_domain(&self) -> anyhow::Result<String> {
|
|
if let Some(git_http_domain) = self.env.get("APP_GIT_HTTP_DOMAIN") {
|
|
return Ok(git_http_domain.to_string());
|
|
}
|
|
self.main_domain()
|
|
}
|
|
}
|