@@ -13,6 +13,7 @@ use crate::acquisition::SharedAudioStream;
1313use crate :: config:: { Config , GenerixConfig } ;
1414use crate :: include_png_as_base64;
1515use crate :: processing:: nodes:: streaming_registry:: StreamingNodeRegistry ;
16+ use crate :: thermal_regulation:: SharedThermalState ;
1617use crate :: visualization:: api:: graph:: graph:: * ;
1718use crate :: visualization:: api:: * ;
1819use crate :: visualization:: auth:: {
@@ -51,6 +52,7 @@ use tokio::sync::RwLock;
5152/// * `audio_stream` - Optional shared audio stream for real-time audio endpoints
5253/// * `visualization_state` - Optional shared visualization state for statistics
5354/// * `streaming_registry` - Optional streaming node registry for audio processing
55+ /// * `thermal_state` - Optional shared thermal regulation state for temperature control
5456///
5557/// ### Returns
5658///
@@ -72,7 +74,7 @@ use tokio::sync::RwLock;
7274/// async fn example() {
7375/// let figment = Figment::from(rocket::Config::default());
7476/// let config = Arc::new(RwLock::new(Config::default()));
75- /// let rocket = server::build_rocket(figment, config, None, None, None).await;
77+ /// let rocket = server::build_rocket(figment, config, None, None, None, None ).await;
7678/// // Launch the server
7779/// // rocket.launch().await.expect("Failed to launch");
7880/// }
@@ -83,6 +85,7 @@ pub async fn build_rocket(
8385 audio_stream : Option < Arc < SharedAudioStream > > ,
8486 visualization_state : Option < Arc < SharedVisualizationState > > ,
8587 streaming_registry : Option < Arc < StreamingNodeRegistry > > ,
88+ thermal_state : Option < SharedThermalState > ,
8689) -> Rocket < Build > {
8790 // Load hmac secret from config
8891 let config_read = config. read ( ) . await ;
@@ -202,6 +205,15 @@ pub async fn build_rocket(
202205 . manage ( jwt_validator)
203206 . manage ( config. clone ( ) ) ; // Add config as managed state for future dynamic configuration
204207
208+ // Add thermal regulation state if available
209+ let rocket_builder = if let Some ( thermal_state) = thermal_state {
210+ debug ! ( "Adding SharedThermalState to Rocket state management" ) ;
211+ rocket_builder. manage ( thermal_state)
212+ } else {
213+ debug ! ( "No thermal state provided, thermal regulation API will return 404" ) ;
214+ rocket_builder
215+ } ;
216+
205217 // Attach compression fairing if enabled in config and not using VITE_DEVELOPMENT
206218 // VITE_DEVELOPMENT is an environment variable for proxying Vite dev server
207219 let rocket_builder = if compression_config && !std:: env:: var ( "VITE_DEVELOPMENT" ) . is_ok ( ) {
0 commit comments