24 lines
735 B
Rust
24 lines
735 B
Rust
use crate::AppConfig;
|
|
|
|
impl AppConfig {
|
|
pub fn app_name(&self) -> anyhow::Result<String> {
|
|
if let Some(name) = self.env.get("APP_NAME") {
|
|
return Ok(name.to_string());
|
|
}
|
|
Ok(env!("CARGO_PKG_NAME").to_string())
|
|
}
|
|
|
|
pub fn app_version(&self) -> anyhow::Result<String> {
|
|
if let Some(version) = self.env.get("APP_VERSION") {
|
|
return Ok(version.to_string());
|
|
}
|
|
Ok(env!("CARGO_PKG_VERSION").to_string())
|
|
}
|
|
pub fn app_description(&self) -> anyhow::Result<String> {
|
|
if let Some(description) = self.env.get("APP_DESCRIPTION") {
|
|
return Ok(description.to_string());
|
|
}
|
|
Ok(env!("CARGO_PKG_DESCRIPTION").to_string())
|
|
}
|
|
}
|