@@ -16,8 +16,8 @@ use temps_core::error_builder::ErrorBuilder;
1616use temps_core:: {
1717 problemdetails:: Problem , AiConfigSettings , AppSettings , AuditContext , AuditLogger ,
1818 AuditOperation , ContainerLogSettings , DiskSpaceAlertSettings , LetsEncryptSettings ,
19- MetricsStoreKind , RateLimitSettings , RequestMetadata , ScreenshotSettings ,
20- SecurityHeadersSettings ,
19+ MetricsStoreKind , PublicHostnameSettings , PublicHostnameStrategy , RateLimitSettings ,
20+ RequestMetadata , ScreenshotSettings , SecurityHeadersSettings ,
2121} ;
2222use tracing:: { error, info} ;
2323use utoipa:: { OpenApi , ToSchema } ;
@@ -80,6 +80,7 @@ pub struct AppSettingsResponse {
8080 pub external_url : Option < String > ,
8181 pub internal_url : Option < String > ,
8282 pub preview_domain : String ,
83+ pub public_hostnames : PublicHostnameSettings ,
8384
8485 // Screenshot settings
8586 pub screenshots : ScreenshotSettings ,
@@ -239,6 +240,7 @@ impl From<AppSettings> for AppSettingsResponse {
239240 external_url : settings. external_url ,
240241 internal_url : settings. internal_url ,
241242 preview_domain : settings. preview_domain ,
243+ public_hostnames : settings. public_hostnames ,
242244 screenshots : settings. screenshots ,
243245 letsencrypt : settings. letsencrypt ,
244246 dns_provider : DnsProviderSettingsMasked {
@@ -350,6 +352,8 @@ impl AppSettingsResponse {
350352 crate :: disk_status:: DiskSpaceAlert ,
351353 crate :: disk_status:: DiskSpaceCheckResult ,
352354 ContainerLogSettings ,
355+ PublicHostnameSettings ,
356+ PublicHostnameStrategy ,
353357 DnsProviderSettingsMasked ,
354358 DockerRegistrySettingsMasked ,
355359 AgentSandboxSettingsMasked ,
@@ -475,6 +479,21 @@ fn preserve_self_recorded_fields(incoming: &mut AppSettings, current: &AppSettin
475479 incoming. console_version = current. console_version . clone ( ) ;
476480}
477481
482+ fn normalize_public_hostname_templates ( settings : & mut AppSettings ) {
483+ fn normalize_template ( template : & mut Option < String > ) {
484+ if let Some ( value) = template. take ( ) {
485+ let trimmed = value. trim ( ) . to_string ( ) ;
486+ if !trimmed. is_empty ( ) {
487+ * template = Some ( trimmed) ;
488+ }
489+ }
490+ }
491+
492+ normalize_template ( & mut settings. public_hostnames . environment_template ) ;
493+ normalize_template ( & mut settings. public_hostnames . service_template ) ;
494+ normalize_template ( & mut settings. public_hostnames . deployment_template ) ;
495+ }
496+
478497/// Update application settings
479498#[ utoipa:: path(
480499 tag = "Settings" ,
@@ -699,6 +718,8 @@ async fn update_settings(
699718 }
700719 }
701720
721+ normalize_public_hostname_templates ( & mut settings) ;
722+
702723 match app_state. config_service . update_settings ( settings) . await {
703724 Ok ( _) => {
704725 let audit = SettingsUpdatedAudit {
0 commit comments