move env file to etc folder
This commit is contained in:
@@ -1,8 +1,9 @@
|
||||
use diesel::prelude::*;
|
||||
use diesel::pg::PgConnection;
|
||||
use diesel::result::Error;
|
||||
use dotenvy::dotenv;
|
||||
use dotenvy::{from_path};
|
||||
use std::env;
|
||||
use std::path::Path;
|
||||
use serde::{Serialize};
|
||||
use diesel_derive_enum::DbEnum;
|
||||
use std::str::FromStr;
|
||||
@@ -49,7 +50,8 @@ pub struct NewDid<'a> {
|
||||
}
|
||||
|
||||
pub fn connect() -> PgConnection {
|
||||
dotenv().ok();
|
||||
let env_path = Path::new("/etc/did_router.conf");
|
||||
from_path(env_path).expect("env file missed");
|
||||
|
||||
let database_url = env::var("DATABASE_URL").expect("DATABASE_URL must be set");
|
||||
PgConnection::establish(&database_url)
|
||||
|
||||
Reference in New Issue
Block a user