diff --git a/sdk/src/apl/mod.rs b/sdk/src/apl/mod.rs index b684a9e..dd1b2e1 100644 --- a/sdk/src/apl/mod.rs +++ b/sdk/src/apl/mod.rs @@ -1,4 +1,4 @@ -pub mod env_apl; +#[cfg(feature = "file_apl")] pub mod file_apl; #[cfg(feature = "redis_apl")] pub mod redis_apl; @@ -12,7 +12,6 @@ use serde::{Deserialize, Serialize}; pub enum AplType { Redis, File, - Env, } #[async_trait] diff --git a/sdk/src/lib.rs b/sdk/src/lib.rs index 9684ebd..99e7621 100644 --- a/sdk/src/lib.rs +++ b/sdk/src/lib.rs @@ -9,11 +9,11 @@ pub mod manifest; pub mod middleware; pub mod webhooks; +use anyhow::bail; use apl::{AplType, APL}; use config::Config; use serde::{Deserialize, Serialize}; -use crate::apl::env_apl::EnvApl; #[cfg(feature = "file_apl")] use crate::apl::file_apl::FileApl; #[cfg(feature = "redis_apl")] @@ -55,7 +55,7 @@ pub struct SaleorApp { impl SaleorApp { pub fn new(config: &Config) -> anyhow::Result { - use AplType::{Env, File, Redis}; + use AplType::{File, Redis}; fn decide_apl(config: &Config) -> anyhow::Result> { match config.apl { Redis => { @@ -67,11 +67,9 @@ impl SaleorApp { #[cfg(not(feature = "redis_apl"))] { - dbg!("Tried starting app with apl that wasn't present at compile time (cargo feature missing). Falling back to env_apl"); - Ok(Box::new(EnvApl {})) + bail!("Tried starting app with apl that wasn't present at compile time (cargo feature missing)") } } - Env => Ok(Box::new(EnvApl {})), File => { #[cfg(feature = "file_apl")] return Ok(Box::new(FileApl { @@ -79,8 +77,7 @@ impl SaleorApp { })); #[cfg(not(feature = "file_apl"))] { - dbg!("Tried starting app with apl that wasn't present at compile time (cargo feature missing). Falling back to env_apl"); - Ok(Box::new(EnvApl {})) + bail!("Tried starting app with apl that wasn't present at compile time (cargo feature missing)") } } }