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