diff options
author | Alex Auvolat <lx@deuxfleurs.fr> | 2025-01-30 10:44:08 +0100 |
---|---|---|
committer | Alex Auvolat <lx@deuxfleurs.fr> | 2025-01-30 10:44:08 +0100 |
commit | 145130481eac30793c6c08caa4d208ddddfc30e8 (patch) | |
tree | 7f29aaa6f8016f8cd1ea5220e51ece43bebf6d15 /src/garage/main.rs | |
parent | 6ed78abb5cd09f4e5ca5effe5d6137faf33133f8 (diff) | |
download | garage-145130481eac30793c6c08caa4d208ddddfc30e8.tar.gz garage-145130481eac30793c6c08caa4d208ddddfc30e8.zip |
wip: proxy admin api requests through admin rpc, prepare new cli
Diffstat (limited to 'src/garage/main.rs')
-rw-r--r-- | src/garage/main.rs | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/garage/main.rs b/src/garage/main.rs index ac95e854..8b5af5ea 100644 --- a/src/garage/main.rs +++ b/src/garage/main.rs @@ -6,6 +6,7 @@ extern crate tracing; mod admin; mod cli; +mod cli_v2; mod repair; mod secrets; mod server; @@ -284,10 +285,11 @@ async fn cli_command(opt: Opt) -> Result<(), Error> { let system_rpc_endpoint = netapp.endpoint::<SystemRpc, ()>(SYSTEM_RPC_PATH.into()); let admin_rpc_endpoint = netapp.endpoint::<AdminRpc, ()>(ADMIN_RPC_PATH.into()); - match cli_command_dispatch(opt.cmd, &system_rpc_endpoint, &admin_rpc_endpoint, id).await { - Err(HelperError::Internal(i)) => Err(Error::Message(format!("Internal error: {}", i))), - Err(HelperError::BadRequest(b)) => Err(Error::Message(b)), - Err(e) => Err(Error::Message(format!("{}", e))), - Ok(x) => Ok(x), - } + let cli = cli_v2::Cli { + system_rpc_endpoint, + admin_rpc_endpoint, + rpc_host: id, + }; + + cli.handle(opt.cmd).await } |