systemprompt_cli/commands/cloud/tenant/create/
mod.rs1mod cloud;
11mod local;
12pub mod progress;
13
14pub use cloud::create_cloud_tenant;
15pub use local::{
16 create_external_tenant, create_local_tenant, handle_orphaned_volume, resolve_container_state,
17};
18pub use systemprompt_cloud::tenants::swap_to_external_host;
19
20fn sanitize_database_name(name: &str) -> String {
21 let sanitized: String = name
22 .chars()
23 .map(|c| {
24 if c.is_ascii_alphanumeric() || c == '_' {
25 c
26 } else {
27 '_'
28 }
29 })
30 .collect();
31
32 if sanitized.is_empty() {
33 "systemprompt".to_owned()
34 } else if sanitized.chars().next().is_some_and(|c| c.is_ascii_digit()) {
35 format!("db_{}", sanitized)
36 } else {
37 sanitized
38 }
39}