Skip to main content

systemprompt_cli/commands/admin/config/
mod.rs

1pub mod paths;
2pub mod rate_limits;
3pub mod runtime;
4pub mod security;
5pub mod server;
6pub mod show;
7pub mod types;
8
9use anyhow::Result;
10use clap::Subcommand;
11
12use crate::cli_settings::get_global_config;
13use crate::CliConfig;
14
15#[derive(Debug, Subcommand)]
16pub enum ConfigCommands {
17    #[command(about = "Show configuration overview")]
18    Show,
19
20    #[command(subcommand, about = "Rate limit configuration")]
21    RateLimits(rate_limits::RateLimitsCommands),
22
23    #[command(subcommand, about = "Server configuration")]
24    Server(server::ServerCommands),
25
26    #[command(subcommand, about = "Runtime configuration")]
27    Runtime(runtime::RuntimeCommands),
28
29    #[command(subcommand, about = "Security configuration")]
30    Security(security::SecurityCommands),
31
32    #[command(subcommand, about = "Paths configuration")]
33    Paths(paths::PathsCommands),
34}
35
36pub fn execute(command: ConfigCommands, config: &CliConfig) -> Result<()> {
37    match command {
38        ConfigCommands::Show => show::execute(config),
39        ConfigCommands::RateLimits(cmd) => rate_limits::execute(cmd, config),
40        ConfigCommands::Server(ref cmd) => server::execute(cmd, config),
41        ConfigCommands::Runtime(cmd) => runtime::execute(cmd, config),
42        ConfigCommands::Security(ref cmd) => security::execute(cmd, config),
43        ConfigCommands::Paths(cmd) => paths::execute(cmd, config),
44    }
45}
46
47pub fn execute_default() -> Result<()> {
48    let config = get_global_config();
49    show::execute(&config)
50}