mirror of
				https://github.com/MindWorkAI/AI-Studio.git
				synced 2025-11-04 08:20:21 +00:00 
			
		
		
		
	Refactored environmental functions
This commit is contained in:
		
							parent
							
								
									74522dc22a
								
							
						
					
					
						commit
						eb8165556a
					
				
							
								
								
									
										7
									
								
								runtime/src/environment.rs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										7
									
								
								runtime/src/environment.rs
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,7 @@
 | 
				
			|||||||
 | 
					pub fn is_dev() -> bool {
 | 
				
			||||||
 | 
					    cfg!(debug_assertions)
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					pub fn is_prod() -> bool {
 | 
				
			||||||
 | 
					    !is_dev()
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@ -1 +1,2 @@
 | 
				
			|||||||
pub mod encryption;
 | 
					pub mod encryption;
 | 
				
			||||||
 | 
					pub mod environment;
 | 
				
			||||||
@ -640,14 +640,6 @@ async fn dotnet_ready(_token: APIToken) {
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
pub fn is_dev() -> bool {
 | 
					 | 
				
			||||||
    cfg!(debug_assertions)
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
pub fn is_prod() -> bool {
 | 
					 | 
				
			||||||
    !is_dev()
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
fn get_available_port() -> Option<u16> {
 | 
					fn get_available_port() -> Option<u16> {
 | 
				
			||||||
    TcpListener::bind(("127.0.0.1", 0))
 | 
					    TcpListener::bind(("127.0.0.1", 0))
 | 
				
			||||||
        .map(|listener| listener.local_addr().unwrap().port())
 | 
					        .map(|listener| listener.local_addr().unwrap().port())
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user