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: anthropic env var (#4150)

Will Hutchinsoneea1a52ed53c
diff --git a/.github/workspace-dep-closures.json b/.github/workspace-dep-closures.json
index c2ab39e5cf..dd1f0d6c7e 100644
--- a/.github/workspace-dep-closures.json
+++ b/.github/workspace-dep-closures.json
@@ -133,6 +133,7 @@
"ai_toolset",
"anthropic",
"cowlike",
+ "macro_env_var",
"macro_user_id",
"workspace-hack"
],
diff --git a/rust/cloud-storage/Cargo.lock b/rust/cloud-storage/Cargo.lock
index 181b3a7f9a..14c384240c 100644
--- a/rust/cloud-storage/Cargo.lock
+++ b/rust/cloud-storage/Cargo.lock
@@ -331,6 +331,7 @@ dependencies = [
"chrono",
"futures",
"lazy_static",
+ "macro_env_var",
"rand 0.9.4",
"regex",
"reqwest 0.13.4",
diff --git a/rust/cloud-storage/anthropic/Cargo.toml b/rust/cloud-storage/anthropic/Cargo.toml
index b0c56cb914..12dd1d1d55 100644
--- a/rust/cloud-storage/anthropic/Cargo.toml
+++ b/rust/cloud-storage/anthropic/Cargo.toml
@@ -33,3 +33,4 @@ ai_toolset = { path = "../ai_toolset", optional = true }
async-trait = { workspace = true, optional = true }
anyhow = { workspace = true, optional = true }
workspace-hack = { version = "0.1", path = "../workspace-hack" }
+macro_env_var = { path = "../macro_env_var" }
diff --git a/rust/cloud-storage/anthropic/src/config.rs b/rust/cloud-storage/anthropic/src/config.rs
index b8b33d24b9..149c2021fc 100644
--- a/rust/cloud-storage/anthropic/src/config.rs
+++ b/rust/cloud-storage/anthropic/src/config.rs
@@ -1,7 +1,7 @@
+use macro_env_var::env_var;
use reqwest::header::HeaderMap;
const ANTHROPIC_ROUTER_BASE_URL: &str = "https://api.anthropic.com";
-const ANTHROPIC_API_KEY: &str = "ANTHROPIC_API_KEY";
#[derive(Debug, Clone, Default)]
pub struct Config {
@@ -9,9 +9,13 @@ pub struct Config {
pub headers: HeaderMap,
}
+env_var! {
+ pub struct AnthropicApiKey;
+}
+
impl Config {
pub fn dangrously_try_from_env() -> Self {
- let api_key = std::env::var(ANTHROPIC_API_KEY).expect("api key");
+ let api_key = AnthropicApiKey::new().expect("api key");
let mut headers = HeaderMap::new();
headers.insert("x-api-key", api_key.parse().expect("good config"));
headers.insert(