From e471bf8adb5ce4677a63faf47a27b3d4f3ffc952 Mon Sep 17 00:00:00 2001 From: djkato Date: Wed, 10 Jul 2024 15:08:20 +0200 Subject: [PATCH] remove env_apl as fallback, just crash instead --- sdk/src/apl/mod.rs | 3 +-- sdk/src/lib.rs | 11 ++++------- 2 files changed, 5 insertions(+), 9 deletions(-) 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)") } } }