From eb8165556aaa0bd1120a09aee605908dce124bf6 Mon Sep 17 00:00:00 2001 From: Thorsten Sommer Date: Tue, 5 Nov 2024 15:13:59 +0100 Subject: [PATCH] Refactored environmental functions --- runtime/src/environment.rs | 7 +++++++ runtime/src/lib.rs | 3 ++- runtime/src/main.rs | 8 -------- 3 files changed, 9 insertions(+), 9 deletions(-) create mode 100644 runtime/src/environment.rs diff --git a/runtime/src/environment.rs b/runtime/src/environment.rs new file mode 100644 index 00000000..a2735a74 --- /dev/null +++ b/runtime/src/environment.rs @@ -0,0 +1,7 @@ +pub fn is_dev() -> bool { + cfg!(debug_assertions) +} + +pub fn is_prod() -> bool { + !is_dev() +} \ No newline at end of file diff --git a/runtime/src/lib.rs b/runtime/src/lib.rs index b429dff2..0b057dcc 100644 --- a/runtime/src/lib.rs +++ b/runtime/src/lib.rs @@ -1 +1,2 @@ -pub mod encryption; \ No newline at end of file +pub mod encryption; +pub mod environment; \ No newline at end of file diff --git a/runtime/src/main.rs b/runtime/src/main.rs index 97afce06..7c6c84ed 100644 --- a/runtime/src/main.rs +++ b/runtime/src/main.rs @@ -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 { TcpListener::bind(("127.0.0.1", 0)) .map(|listener| listener.local_addr().unwrap().port())