diff --git a/crates/maestro-registry/src/run.rs b/crates/maestro-registry/src/run.rs index cfd17a7..111ba7a 100644 --- a/crates/maestro-registry/src/run.rs +++ b/crates/maestro-registry/src/run.rs @@ -9,13 +9,14 @@ use std::path::PathBuf; use tokio::net::TcpListener; use crate::{ - default_config_path, load_config, router, Registry, CONFIG_PATH_ENV, ENV_REGISTRY_BIND_ADDR, - ENV_TOKEN, + default_config_path, load_config, router, Registry, ENV_REGISTRY_BIND_ADDR, ENV_TOKEN, }; -pub async fn run() -> Result<(), Box> { - let config_path: PathBuf = match std::env::var_os(CONFIG_PATH_ENV) { - Some(p) => PathBuf::from(p), +/// Run the registry. `config_override` is the top-level `--config` flag from +/// the umbrella binary (also populated from `$MAESTRO_CONFIG` by clap). +pub async fn run(config_override: Option) -> Result<(), Box> { + let config_path: PathBuf = match config_override { + Some(p) => p, None => default_config_path()?, }; let env_token = std::env::var(ENV_TOKEN).ok(); diff --git a/crates/maestro/src/main.rs b/crates/maestro/src/main.rs index 1807b51..7a325b4 100644 --- a/crates/maestro/src/main.rs +++ b/crates/maestro/src/main.rs @@ -152,7 +152,7 @@ async fn dispatch(cli: Cli) -> Result<(), Box> { #[cfg(feature = "daemon")] Command::Daemon { cmd } => maestro_daemon::cli::dispatch(cli.config, cmd).await?, #[cfg(feature = "registry")] - Command::Registry => maestro_registry::run().await?, + Command::Registry => maestro_registry::run(cli.config).await?, } Ok(()) }