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