Skip to content

Commit

Permalink
fix env
Browse files Browse the repository at this point in the history
  • Loading branch information
“Giems” committed Mar 6, 2024
1 parent d59dde9 commit ec65114
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .env
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ENV=DEV # PROD or DEV
ONLY_RELAY_SERVICE=TRUE # TRUE - This will start only nightly relay service without cloud service
ONLY_RELAY_SERVICE=True # TRUE - This will start only nightly relay service without cloud service
NONCE=VERY_SECRET_NONCE
JWT_SECRET=VERY_SECRET_SECRET
2 changes: 0 additions & 2 deletions server/src/bin/nightly-connect-server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ use std::sync::mpsc::channel;

#[tokio::main]
async fn main() {
dotenvy::dotenv().expect(".env file not found");

let router = get_router(ONLY_RELAY_SERVICE()).await;
let listener = tokio::net::TcpListener::bind(&"127.0.0.1:6969")
.await
Expand Down
5 changes: 2 additions & 3 deletions server/src/env.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ pub fn get_env() -> &'static ENV {

INSTANCE.get_or_init(|| {
dotenvy::from_filename(".env").ok();
let ENVIRONMENT = std::env::var("ENVIRONMENT").expect("Failed to get ENVIRONMENT env");
let ENVIRONMENT = std::env::var("ENV").expect("Failed to get ENV env");
let ENVIRONMENT = ENVIRONMENT.as_str();

let env = ENV {
Expand All @@ -35,8 +35,7 @@ pub fn get_env() -> &'static ENV {
},
ONLY_RELAY_SERVICE: std::env::var("ONLY_RELAY_SERVICE")
.expect("Failed to get ONLY_RELAY_SERVICE env")
.parse()
.expect("Failed to parse ONLY_RELAY_SERVICE env"),
.eq_ignore_ascii_case("true"),
NONCE: std::env::var("NONCE").expect("Failed to get NONCE env"),
};
return env;
Expand Down

0 comments on commit ec65114

Please sign in to comment.