make .env file optional
for easier containerization the .env file should be optional
This commit is contained in:
		
							parent
							
								
									a223373fc1
								
							
						
					
					
						commit
						9229142a18
					
				
					 1 changed files with 5 additions and 2 deletions
				
			
		| 
						 | 
					@ -1,6 +1,6 @@
 | 
				
			||||||
use actix_web::{App, HttpServer, web::Data};
 | 
					use actix_web::{App, HttpServer, web::Data};
 | 
				
			||||||
use dotenvy::dotenv;
 | 
					use dotenvy::dotenv;
 | 
				
			||||||
use tracing::Level;
 | 
					use tracing::{Level, debug};
 | 
				
			||||||
use tracing_subscriber::FmtSubscriber;
 | 
					use tracing_subscriber::FmtSubscriber;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
mod access;
 | 
					mod access;
 | 
				
			||||||
| 
						 | 
					@ -15,7 +15,10 @@ async fn main() -> std::io::Result<()> {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    tracing::subscriber::set_global_default(subscriber).expect("Could not initialize logging.");
 | 
					    tracing::subscriber::set_global_default(subscriber).expect("Could not initialize logging.");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    dotenv().expect("Could not load .env file.");
 | 
					    let dr = dotenv();
 | 
				
			||||||
 | 
					    if let Err(e) = dr {
 | 
				
			||||||
 | 
					        debug!("Could not load .env file: {}", e);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    let config = config::load_config();
 | 
					    let config = config::load_config();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		
		Reference in a new issue