convergio_types/dev_auth.rs
1//! Development auth helper — reads token from environment with fallback.
2//!
3//! Used by daemon-internal HTTP calls (doctor checks, plan executor, etc.)
4//! to avoid hard-coding auth tokens in source code.
5
6/// Build the `Authorization` header value for internal daemon calls.
7///
8/// Reads `CONVERGIO_AUTH_TOKEN` from the environment; falls back to
9/// `"dev-local"` when the variable is unset (local development only).
10pub fn dev_auth_header() -> String {
11 let token = std::env::var("CONVERGIO_AUTH_TOKEN").unwrap_or_else(|_| "dev-local".into());
12 format!("Bearer {token}")
13}