fix(maestro): drop SHARED_ prefix from [shared] env vars
ci / rust (pull_request) Successful in 4m13s
ci / rust (pull_request) Successful in 4m13s
The shared section is the implicit global scope, so its fields use the bare `MAESTRO_<FIELD>` env-var spelling. Only `[daemon]` and `[registry]` sections get section-prefixed env vars. Renames: - MAESTRO_SHARED_TOKEN → MAESTRO_TOKEN - MAESTRO_SHARED_REGISTRY_URL → MAESTRO_REGISTRY_URL `MAESTRO_DAEMON_*` and `MAESTRO_REGISTRY_BIND_ADDR` are unchanged. This restores the canonical spec name (`MAESTRO_TOKEN`) that operators already use in their deployment scripts — NAP-233 had renamed it to `MAESTRO_SHARED_TOKEN`, which silently broke daemon auth against existing registry deployments still setting `MAESTRO_TOKEN` in env. Constants renamed alongside: `ENV_SHARED_TOKEN` → `ENV_TOKEN`, `ENV_SHARED_REGISTRY_URL` → `ENV_REGISTRY_URL`. `EnvOverrides` fields shed their `shared_` prefix to match. Touches: daemon/cli/registry crates, e2e harness, design spec.
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
//! Cookie-based auth for the client-facing HTTP/WS surface.
|
||||
//!
|
||||
//! On the first request the registry sets an httpOnly cookie whose value is a
|
||||
//! JWT signed with the shared token (`MAESTRO_SHARED_TOKEN`, HS256). Subsequent requests
|
||||
//! JWT signed with the shared token (`MAESTRO_TOKEN`, HS256). Subsequent requests
|
||||
//! must present a cookie whose signature verifies; missing or tampered
|
||||
//! cookies get a fresh cookie issued (effectively re-bootstrapping a
|
||||
//! first-time client) and are still allowed through. The cookie is the second
|
||||
|
||||
@@ -28,5 +28,5 @@ pub use server::{router, router_full, router_with_timeout, RegistryServer};
|
||||
pub use state::{DaemonView, Registry, RegistryError, RpcError, HEARTBEAT_TIMEOUT, RPC_TIMEOUT};
|
||||
pub use token::{
|
||||
default_config_path, ensure_token, load_config, resolve_config_path, RegistryConfig,
|
||||
TokenError, CONFIG_PATH_ENV, ENV_REGISTRY_BIND_ADDR, ENV_SHARED_TOKEN,
|
||||
TokenError, CONFIG_PATH_ENV, ENV_REGISTRY_BIND_ADDR, ENV_TOKEN,
|
||||
};
|
||||
|
||||
@@ -27,7 +27,7 @@ async fn run() -> Result<(), Box<dyn Error>> {
|
||||
Some(p) => PathBuf::from(p),
|
||||
None => default_config_path()?,
|
||||
};
|
||||
let env_token = std::env::var(maestro_registry::ENV_SHARED_TOKEN).ok();
|
||||
let env_token = std::env::var(maestro_registry::ENV_TOKEN).ok();
|
||||
let env_bind = std::env::var(maestro_registry::ENV_REGISTRY_BIND_ADDR).ok();
|
||||
let token_from_env = env_token.is_some();
|
||||
let bind_from_env = env_bind.is_some();
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
//!
|
||||
//! Env-var overrides (applied by [`load_config`]):
|
||||
//!
|
||||
//! - `MAESTRO_SHARED_TOKEN` — when set, bypasses the file entirely (no read,
|
||||
//! - `MAESTRO_TOKEN` — when set, bypasses the file entirely (no read,
|
||||
//! no write). Lets the binary run in a container with no writable volume.
|
||||
//! - `MAESTRO_REGISTRY_BIND_ADDR` — when set, overrides `bind_addr`.
|
||||
//!
|
||||
@@ -30,7 +30,7 @@ pub use maestro_config::{default_config_path, resolve_config_path, CONFIG_PATH_E
|
||||
pub const DEFAULT_BIND_ADDR: &str = "127.0.0.1:8080";
|
||||
|
||||
/// Env var that overrides `[shared].token`.
|
||||
pub const ENV_SHARED_TOKEN: &str = "MAESTRO_SHARED_TOKEN";
|
||||
pub const ENV_TOKEN: &str = "MAESTRO_TOKEN";
|
||||
/// Env var that overrides `[registry].bind_addr`.
|
||||
pub const ENV_REGISTRY_BIND_ADDR: &str = "MAESTRO_REGISTRY_BIND_ADDR";
|
||||
|
||||
@@ -78,7 +78,7 @@ pub fn ensure_token(config_path: &Path) -> Result<RegistryConfig, TokenError> {
|
||||
file.shared.token = Some(token.clone());
|
||||
file.save(config_path)?;
|
||||
eprintln!(
|
||||
"maestro-registry: generated new MAESTRO_SHARED_TOKEN; deploy this to every daemon:\n {token}"
|
||||
"maestro-registry: generated new MAESTRO_TOKEN; deploy this to every daemon:\n {token}"
|
||||
);
|
||||
Ok(RegistryConfig { token, bind_addr })
|
||||
}
|
||||
@@ -88,7 +88,7 @@ pub fn ensure_token(config_path: &Path) -> Result<RegistryConfig, TokenError> {
|
||||
///
|
||||
/// Precedence per field: env > file > default.
|
||||
///
|
||||
/// `env_token` (`MAESTRO_SHARED_TOKEN`): when `Some`, the file is neither
|
||||
/// `env_token` (`MAESTRO_TOKEN`): when `Some`, the file is neither
|
||||
/// read nor created — useful in container deployments without a writable
|
||||
/// volume.
|
||||
/// `env_bind_addr` (`MAESTRO_REGISTRY_BIND_ADDR`): when `Some`, overrides
|
||||
|
||||
Reference in New Issue
Block a user