systemprompt_cli/commands/admin/config/
show.rs1use anyhow::Result;
7use systemprompt_config::ProfileBootstrap;
8
9use super::types::{
10 ConfigOverviewOutput, PathsOverview, RateLimitsSummary, RuntimeOverview, SecurityOverview,
11 ServerOverview,
12};
13use crate::CliConfig;
14use crate::shared::CommandOutput;
15
16pub fn execute(_config: &CliConfig) -> Result<CommandOutput> {
17 let profile = ProfileBootstrap::get()?;
18 let profile_path = ProfileBootstrap::get_path()?;
19
20 let output = ConfigOverviewOutput {
21 profile_name: profile.name.clone(),
22 profile_path: profile_path.to_owned(),
23 server: ServerOverview {
24 host: profile.server.host.clone(),
25 port: profile.server.port,
26 use_https: profile.server.use_https,
27 cors_origins_count: profile.server.cors_allowed_origins.len(),
28 },
29 runtime: RuntimeOverview {
30 environment: profile.runtime.environment.to_string(),
31 log_level: profile.runtime.log_level.to_string(),
32 output_format: profile.runtime.output_format.to_string(),
33 no_color: profile.runtime.no_color,
34 },
35 security: SecurityOverview {
36 jwt_issuer: profile.security.issuer.clone(),
37 access_token_expiry_seconds: profile.security.access_token_expiration,
38 refresh_token_expiry_seconds: profile.security.refresh_token_expiration,
39 audiences_count: profile.security.audiences.len(),
40 },
41 paths: PathsOverview {
42 system: profile.paths.system.clone(),
43 services: profile.paths.services.clone(),
44 bin: profile.paths.bin.clone(),
45 web_path: profile.paths.web_path.clone(),
46 storage: profile.paths.storage.clone(),
47 },
48 rate_limits: RateLimitsSummary {
49 enabled: !profile.rate_limits.disabled,
50 burst_multiplier: profile.rate_limits.burst_multiplier,
51 tier_count: 6,
52 },
53 };
54
55 Ok(CommandOutput::card_value("Configuration Overview", &output))
56}