From 97cb1d6cc86744f2d7bc3e4121d6da029af1203e Mon Sep 17 00:00:00 2001 From: Enola Knezevic <115070135+enola-dkfz@users.noreply.github.com> Date: Fri, 6 Dec 2024 11:26:38 +0100 Subject: [PATCH] separated exporter API key CLA from auth header (#191) --- README.md | 3 ++- src/config.rs | 7 +++++++ src/exporter.rs | 4 ++-- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 54a5828..03f0914 100644 --- a/README.md +++ b/README.md @@ -51,7 +51,8 @@ PROJECTS_NO_OBFUSCATION = "exliquid;dktk_supervisors;exporter;ehds2" # Projects QUERIES_TO_CACHE = "queries_to_cache.conf" # The path to a file containing base64 encoded queries whose results are to be cached. If not set, no results are cached PROVIDER = "name" #EUCAIM provider name PROVIDER_ICON = "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABAQMAAAAl21bKAAAAA1BMVEUAAACnej3aAAAAAXRSTlMAQObYZgAAAApJREFUCNdjYAAAAAIAAeIhvDMAAAAASUVORK5CYII=" # Base64 encoded EUCAIM provider icon -AUTH_HEADER = "ApiKey XXXX" #Authorization header; if the endpoint type is Blaze or BlazeAndSql, this header is used for the Exporter target application, and the syntax is AUTH_HEADER = "XXXX" where "XXXX" is the API key +AUTH_HEADER = "[Auth Type] XXXX" #Authorization header for accessing the store; Auth Type e.g. ApiKey, Basic, ... +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: diff --git a/src/config.rs b/src/config.rs index d45a408..9eca57d 100644 --- a/src/config.rs +++ b/src/config.rs @@ -158,10 +158,15 @@ struct CliArgs { #[clap(long, env, value_parser)] provider_icon: Option, + // TODO - refactor to include multiple authorization headers for multiple stores / applications at the same time /// Authorization header #[clap(long, env, value_parser)] auth_header: Option, + /// Exporter API key + #[clap(long, env, value_parser)] + exporter_api_key: Option, + /// Postgres connection string #[cfg(feature = "query-sql")] #[clap(long, env, value_parser)] @@ -198,6 +203,7 @@ pub(crate) struct Config { pub provider: Option, 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")] @@ -243,6 +249,7 @@ impl Config { provider: cli_args.provider, 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")] diff --git a/src/exporter.rs b/src/exporter.rs index c3eb932..7208f3c 100644 --- a/src/exporter.rs +++ b/src/exporter.rs @@ -42,10 +42,10 @@ pub async fn post_exporter_query(body: &String, task_type: TaskType) -> Result