remove env_apl as fallback, just crash instead
This commit is contained in:
parent
1340398449
commit
e471bf8adb
2 changed files with 5 additions and 9 deletions
|
@ -1,4 +1,4 @@
|
||||||
pub mod env_apl;
|
#[cfg(feature = "file_apl")]
|
||||||
pub mod file_apl;
|
pub mod file_apl;
|
||||||
#[cfg(feature = "redis_apl")]
|
#[cfg(feature = "redis_apl")]
|
||||||
pub mod redis_apl;
|
pub mod redis_apl;
|
||||||
|
@ -12,7 +12,6 @@ use serde::{Deserialize, Serialize};
|
||||||
pub enum AplType {
|
pub enum AplType {
|
||||||
Redis,
|
Redis,
|
||||||
File,
|
File,
|
||||||
Env,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[async_trait]
|
#[async_trait]
|
||||||
|
|
|
@ -9,11 +9,11 @@ pub mod manifest;
|
||||||
pub mod middleware;
|
pub mod middleware;
|
||||||
pub mod webhooks;
|
pub mod webhooks;
|
||||||
|
|
||||||
|
use anyhow::bail;
|
||||||
use apl::{AplType, APL};
|
use apl::{AplType, APL};
|
||||||
use config::Config;
|
use config::Config;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
use crate::apl::env_apl::EnvApl;
|
|
||||||
#[cfg(feature = "file_apl")]
|
#[cfg(feature = "file_apl")]
|
||||||
use crate::apl::file_apl::FileApl;
|
use crate::apl::file_apl::FileApl;
|
||||||
#[cfg(feature = "redis_apl")]
|
#[cfg(feature = "redis_apl")]
|
||||||
|
@ -55,7 +55,7 @@ pub struct SaleorApp {
|
||||||
|
|
||||||
impl SaleorApp {
|
impl SaleorApp {
|
||||||
pub fn new(config: &Config) -> anyhow::Result<SaleorApp> {
|
pub fn new(config: &Config) -> anyhow::Result<SaleorApp> {
|
||||||
use AplType::{Env, File, Redis};
|
use AplType::{File, Redis};
|
||||||
fn decide_apl(config: &Config) -> anyhow::Result<Box<dyn APL>> {
|
fn decide_apl(config: &Config) -> anyhow::Result<Box<dyn APL>> {
|
||||||
match config.apl {
|
match config.apl {
|
||||||
Redis => {
|
Redis => {
|
||||||
|
@ -67,11 +67,9 @@ impl SaleorApp {
|
||||||
|
|
||||||
#[cfg(not(feature = "redis_apl"))]
|
#[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");
|
bail!("Tried starting app with apl that wasn't present at compile time (cargo feature missing)")
|
||||||
Ok(Box::new(EnvApl {}))
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Env => Ok(Box::new(EnvApl {})),
|
|
||||||
File => {
|
File => {
|
||||||
#[cfg(feature = "file_apl")]
|
#[cfg(feature = "file_apl")]
|
||||||
return Ok(Box::new(FileApl {
|
return Ok(Box::new(FileApl {
|
||||||
|
@ -79,8 +77,7 @@ impl SaleorApp {
|
||||||
}));
|
}));
|
||||||
#[cfg(not(feature = "file_apl"))]
|
#[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");
|
bail!("Tried starting app with apl that wasn't present at compile time (cargo feature missing)")
|
||||||
Ok(Box::new(EnvApl {}))
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue