Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

fix: add env var to dss (#3749)

Eric Hayese950b2f4bff5
diff --git a/rust/cloud-storage/document_storage_service/src/config.rs b/rust/cloud-storage/document_storage_service/src/config.rs
index 9d4b6c90f3..b7061db526 100644
--- a/rust/cloud-storage/document_storage_service/src/config.rs
+++ b/rust/cloud-storage/document_storage_service/src/config.rs
@@ -63,6 +63,10 @@ env_var! {
pub LivekitServerUrl,
pub LivekitApiKey,
pub LivekitApiSecret,
+ /// OpenAI API key used to generate task-dedup embeddings. Required —
+ /// injected as `OPENAI_API_KEY` from the `openai-key` secret by the
+ /// infra stack, the same way `document_cognition_service` consumes it.
+ pub OpenaiApiKey,
}
}
@@ -71,12 +75,6 @@ maybe_env_var! {
pub struct LivekitTranscriptionAgentName;
}
-maybe_env_var! {
- /// OpenAI API key used to generate task embeddings. Optional — task
- /// embeddings will fail until it is configured.
- pub struct OpenaiApiKey;
-}
-
maybe_env_var! {
/// Shared secret for internal call endpoints (e.g. transcript ingestion from the agent).
pub struct InternalCallSecret;
diff --git a/rust/cloud-storage/document_storage_service/src/main.rs b/rust/cloud-storage/document_storage_service/src/main.rs
index 65a54d024e..1e341172e4 100644
--- a/rust/cloud-storage/document_storage_service/src/main.rs
+++ b/rust/cloud-storage/document_storage_service/src/main.rs
@@ -576,19 +576,11 @@ async fn main() -> anyhow::Result<()> {
let sqs_client = Arc::new(sqs_client);
let conn_gateway_client = Arc::new(conn_gateway_client);
let task_dedup_config = TaskDedupConfig::default();
- // Local reads the OpenAI key from the environment; dev/prod pull the same
- // `openai-key` secret the backfill entrypoint uses. Fail fast if it's empty
- // so the service never starts with a broken task-dedup embedder.
- let openai_api_key = match config.environment {
- Environment::Local => config::OpenaiApiKey::new()
- .map(|v| v.as_ref().to_owned())
- .unwrap_or_default(),
- _ => secretsmanager_client
- .get_secret_value("openai-key")
- .await
- .context("unable to get OpenAI embedding secret")?
- .to_string(),
- };
+ // The OpenAI key is injected as the required `OPENAI_API_KEY` env var
+ // (resolved from the `openai-key` secret at deploy time by the infra stack),
+ // the same way `document_cognition_service` consumes it. Fail fast if it's
+ // empty so the service never starts with a broken task-dedup embedder.
+ let openai_api_key = config.vars.openai_api_key.as_ref().to_owned();
anyhow::ensure!(
!openai_api_key.trim().is_empty(),
"OpenAI API key is required for task dedup embeddings",