feat(env): support configuring logger from .env file

This commit is contained in:
Orhun Parmaksız 2022-05-21 09:07:37 +03:00
parent 63c79b8297
commit 3467038353
No known key found for this signature in database
GPG key ID: F83424824B3E4B90

View file

@ -18,11 +18,13 @@ use std::time::Duration;
#[actix_web::main]
async fn main() -> IoResult<()> {
// Load the .env file.
dotenv::dotenv().ok();
// Initialize logger.
env_logger::init_from_env(env_logger::Env::new().default_filter_or("info"));
// Parse configuration.
dotenv::dotenv().ok();
let config_path = match env::var(CONFIG_ENV).ok() {
Some(path) => {
env::remove_var(CONFIG_ENV);