refactor(maestro): wire --config flag through to maestro registry
`registry::run` now accepts an `Option<PathBuf>` config override so the umbrella binary's `--config` flag (and its clap-bound `MAESTRO_CONFIG` env var) reach the registry, mirroring how the daemon already consumed the override.
This commit is contained in:
@@ -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<dyn Error>> {
|
||||
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<PathBuf>) -> Result<(), Box<dyn Error>> {
|
||||
let config_path: PathBuf = match config_override {
|
||||
Some(p) => p,
|
||||
None => default_config_path()?,
|
||||
};
|
||||
let env_token = std::env::var(ENV_TOKEN).ok();
|
||||
|
||||
@@ -152,7 +152,7 @@ async fn dispatch(cli: Cli) -> Result<(), Box<dyn std::error::Error>> {
|
||||
#[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(())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user