diff --git a/Cargo.toml b/Cargo.toml index 969c357..9a379f2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -62,14 +62,15 @@ url = "2.5.2" unftp-auth-pam = { version = "0.2.5", optional = true } [features] -default = ["rest_auth", "cloud_storage", "jsonfile_auth"] +default = ["rest_auth", "cloud_storage", "jsonfile_auth", "opendal"] all_extentions = ["pam_auth", "rest_auth", "jsonfile_auth", "cloud_storage"] cloud_storage = ["unftp-sbe-gcs"] jsonfile_auth = ["unftp-auth-jsonfile"] pam_auth = ["unftp-auth-pam"] rest_auth = ["unftp-auth-rest"] tokio_console = ["console-subscriber", "tokio/tracing"] -azblob = ["dep:unftp-sbe-opendal", "dep:opendal", "opendal/services-azblob"] +opendal = ["dep:unftp-sbe-opendal", "dep:opendal"] +azblob = ["opendal/services-azblob"] # With this we link dynamically to libc and pam gnu = ["all_extentions"] diff --git a/src/main.rs b/src/main.rs index 114ec7d..359d17c 100644 --- a/src/main.rs +++ b/src/main.rs @@ -359,7 +359,8 @@ fn gcs_storage_backend(log: &Logger, m: &clap::ArgMatches) -> Result Result { +#[cfg(feature = "azblob")] +pub fn azblob_storage_backend(log: &Logger, m: &clap::ArgMatches) -> Result { let mut b = opendal::services::Azblob::default(); if let Some(val) = m.value_of(args::AZBLOB_ROOT) { b.root(val); @@ -417,6 +418,7 @@ fn start_ftp( match m.value_of(args::STORAGE_BACKEND_TYPE) { None | Some("filesystem") => svc(fs_storage_backend(root_log, m)), Some("gcs") => svc(gcs_storage_backend(root_log, m)?), + #[cfg(feature = "azblob")] Some("azblob") => svc(azblob_storage_backend(root_log, m)?), Some(x) => Err(format!("unknown storage back-end type {}", x)), }