From f0723ca370edb14d20f2d5f68ac69b23c57d019d Mon Sep 17 00:00:00 2001 From: Enola Knezevic Date: Tue, 5 May 2026 16:04:11 +0200 Subject: [PATCH 1/2] removed remnants of features --- Cargo.toml | 9 +++------ README.md | 2 +- src/config.rs | 13 ------------- src/errors.rs | 1 - src/main.rs | 24 ------------------------ 5 files changed, 4 insertions(+), 45 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 2452481..b9ef6cd 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -31,6 +31,7 @@ rand = { default-features = false, version = "0.9.0" } futures-util = { version = "0.3", default-features = false, features = ["std"] } tryhard = "0.5" + # Logging tracing = { version = "0.1.37", default-features = false } tracing-subscriber = { version = "0.3.11", default-features = false, features = [ @@ -58,17 +59,13 @@ sqlx = { version = "0.8.2", features = [ "chrono", "rust_decimal", "uuid", -], optional = true } +]} kurtbuilds_sqlx_serde = { version = "0.3.2", features = [ "json", "decimal", "chrono", "uuid", -], optional = true } - -[features] -default = ["query-sql"] -query-sql = ["dep:sqlx", "dep:kurtbuilds_sqlx_serde"] +]} [dev-dependencies] pretty_assertions = "1.4.0" diff --git a/README.md b/README.md index d288233..54d86b7 100644 --- a/README.md +++ b/README.md @@ -56,7 +56,7 @@ AUTH_HEADER = "[Auth Type] XXXX" #Authorization header for accessing the store; EXPORTER_API_KEY = "XXXX" # Value of header x-api-key for accessing the Exporter application ``` -In order to use Postgres querying, a Docker image built with the feature "dktk" needs to be used and this optional variable set: +In order to use Postgres querying this optional variable needs to be set: ```bash POSTGRES_CONNECTION_STRING = "postgresql://postgres:Test.123@localhost:5432/postgres" # Postgres connection string ``` diff --git a/src/config.rs b/src/config.rs index 9d174a2..32144ff 100644 --- a/src/config.rs +++ b/src/config.rs @@ -24,11 +24,8 @@ pub enum EndpointType { Omop, // endpoint is URL of a query mediator translating AST to provider specific SQL EucaimApi, // endpoint is URL of custom API for querying EUCAIM provider EucaimBeacon, - #[cfg(feature = "query-sql")] EucaimSql, - #[cfg(feature = "query-sql")] BlazeAndSql, - #[cfg(feature = "query-sql")] Sql, } @@ -39,11 +36,8 @@ impl fmt::Display for EndpointType { EndpointType::Omop => write!(f, "omop"), EndpointType::EucaimApi => write!(f, "eucaim_api"), EndpointType::EucaimBeacon => write!(f, "eucaim_beacon"), - #[cfg(feature = "query-sql")] EndpointType::EucaimSql => write!(f, "eucaim_sql"), - #[cfg(feature = "query-sql")] EndpointType::BlazeAndSql => write!(f, "blaze_and_sql"), - #[cfg(feature = "query-sql")] EndpointType::Sql => write!(f, "sql"), } } @@ -190,12 +184,10 @@ struct CliArgs { exporter_api_key: Option, /// Postgres connection string - #[cfg(feature = "query-sql")] #[clap(long, env, value_parser)] postgres_connection_string: Option, /// Max number of attempts to connect to the database - #[cfg(feature = "query-sql")] #[clap(long, env, value_parser, default_value = "8")] max_db_attempts: u32, } @@ -229,9 +221,7 @@ pub(crate) struct Config { pub provider_icon: Option, pub auth_header: Option, pub exporter_api_key: Option, - #[cfg(feature = "query-sql")] pub postgres_connection_string: Option, - #[cfg(feature = "query-sql")] pub max_db_attempts: u32, } @@ -256,7 +246,6 @@ impl Config { api_key: cli_args.api_key, retry_count: cli_args.retry_count, endpoint_url: match cli_args.endpoint_type{ - #[cfg(feature = "query-sql")] EndpointType::Sql|EndpointType::EucaimSql => {Url::parse("http://localhost").unwrap()} // dummy value, never used, only Postgres connection string is used in those cases _ => { cli_args.endpoint_url.unwrap_or_else(|| cli_args.blaze_url.expect("Look, mate, you need to set endpoint-url or blaze-url, can't work without, sry")) @@ -284,9 +273,7 @@ impl Config { provider_icon: cli_args.provider_icon, auth_header: cli_args.auth_header, exporter_api_key: cli_args.exporter_api_key, - #[cfg(feature = "query-sql")] postgres_connection_string: cli_args.postgres_connection_string, - #[cfg(feature = "query-sql")] max_db_attempts: cli_args.max_db_attempts, client, }; diff --git a/src/errors.rs b/src/errors.rs index d79cab7..c5a2cbc 100644 --- a/src/errors.rs +++ b/src/errors.rs @@ -73,7 +73,6 @@ pub enum FocusError { QueryNotAllowed(String), #[error("CQL lang not enabled")] CqlLangNotEnabled, - #[cfg(feature = "query-sql")] #[error("Error executing SQL query: {0}")] ErrorExecutingSqlQuery(sqlx::Error), #[error("Unknown project: {0}")] diff --git a/src/main.rs b/src/main.rs index d250abf..51f4f11 100644 --- a/src/main.rs +++ b/src/main.rs @@ -17,14 +17,8 @@ mod mr; mod task_processing; mod transformed; mod util; - -#[cfg(feature = "query-sql")] mod db; - -#[cfg(feature = "query-sql")] mod eucaim_sql; - -#[cfg(feature = "query-sql")] use sqlx::Row; use base64::engine::general_purpose; @@ -198,18 +192,8 @@ pub async fn main() -> ExitCode { } } -#[cfg(not(feature = "query-sql"))] -type DbPool = (); - -#[cfg(feature = "query-sql")] type DbPool = sqlx::PgPool; -#[cfg(not(feature = "query-sql"))] -async fn get_db_pool() -> Result, ExitCode> { - Ok(None) -} - -#[cfg(feature = "query-sql")] async fn get_db_pool() -> Result, ExitCode> { use tracing::info; @@ -242,11 +226,8 @@ async fn main_loop() -> ExitCode { EndpointType::Omop | EndpointType::EucaimApi | EndpointType::EucaimBeacon => { || async { true }.boxed() } // TODO health check - #[cfg(feature = "query-sql")] EndpointType::EucaimSql => || async { true }.boxed(), - #[cfg(feature = "query-sql")] EndpointType::BlazeAndSql => || blaze::check_availability().boxed(), - #[cfg(feature = "query-sql")] EndpointType::Sql => || async { true }.boxed(), }; let mut failures = 0; @@ -353,7 +334,6 @@ async fn process_task( ) .await } - #[cfg(feature = "query-sql")] EndpointType::BlazeAndSql => { let mut generated_from_ast: bool = false; let data = base64_decode(&task.body)?; @@ -400,7 +380,6 @@ async fn process_task( } } } - #[cfg(feature = "query-sql")] EndpointType::Sql => { let data = base64_decode(&task.body)?; let query_maybe: Result = @@ -465,7 +444,6 @@ async fn process_task( Ok(run_eucaim_api_query(task, ast).await?) } - #[cfg(feature = "query-sql")] EndpointType::EucaimSql => { let decoded = util::base64_decode(&task.body)?; let intermediate_rep_query: intermediate_rep::IntermediateRepQuery = @@ -504,7 +482,6 @@ async fn process_task( } } -#[cfg(feature = "query-sql")] async fn run_eucaim_sql_query( task: &TaskRequest, pool: sqlx::Pool, @@ -591,7 +568,6 @@ async fn run_eucaim_sql_query( } } -#[cfg(feature = "query-sql")] async fn run_sql_key_query( task: &TaskRequest, pool: sqlx::Pool, From f77205cebba8615fd9b415d4375195bd98cc218f Mon Sep 17 00:00:00 2001 From: Enola Knezevic Date: Tue, 5 May 2026 16:06:43 +0200 Subject: [PATCH 2/2] fmt --- src/main.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main.rs b/src/main.rs index 51f4f11..c00c833 100644 --- a/src/main.rs +++ b/src/main.rs @@ -8,8 +8,10 @@ mod errors; mod graceful_shutdown; mod logger; +mod db; mod eucaim_api; mod eucaim_beacon; +mod eucaim_sql; mod exporter; mod flavours; mod intermediate_rep; @@ -17,8 +19,6 @@ mod mr; mod task_processing; mod transformed; mod util; -mod db; -mod eucaim_sql; use sqlx::Row; use base64::engine::general_purpose;