Skip to main content

systemprompt_cli/commands/admin/config/
mod.rs

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