refactor: adapters configured from config crate
This commit is contained in:
@@ -18,11 +18,8 @@ pub struct ConversionConfig {
|
||||
}
|
||||
|
||||
impl ConversionConfig {
|
||||
pub fn from_env() -> anyhow::Result<Option<Self>> {
|
||||
Self::from_vars(
|
||||
std::env::var("IMAGE_CONVERSION_ENABLED").ok().as_deref(),
|
||||
std::env::var("IMAGE_CONVERSION_FORMAT").ok().as_deref(),
|
||||
)
|
||||
pub fn from_config(config: &::config::ImageConversionConfig) -> anyhow::Result<Option<Self>> {
|
||||
Self::from_vars(config.enabled.then_some("true"), config.format.as_deref())
|
||||
}
|
||||
|
||||
fn from_vars(enabled: Option<&str>, format: Option<&str>) -> anyhow::Result<Option<Self>> {
|
||||
|
||||
Reference in New Issue
Block a user