WIP add password file
This commit is contained in:
parent
628f9eefc3
commit
7239578f95
2 changed files with 14 additions and 3 deletions
|
|
@ -180,11 +180,22 @@ async fn get_stats_row(db: &DatabaseConnection) -> Result<stats::ActiveModel, Db
|
|||
})
|
||||
}
|
||||
|
||||
impl SqlAdaptor {
|
||||
pub async fn new() -> Self {
|
||||
fn get_connection_string() -> String {
|
||||
let connection_string =
|
||||
env::var("DATABASE_URL").expect("Expected DATABASE_URL environment variable");
|
||||
|
||||
if let Some(password_file_location) = env::var("DATABASE_PASSWORD_FILE") {
|
||||
|
||||
} else {
|
||||
connection_string
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
impl SqlAdaptor {
|
||||
pub async fn new() -> Self {
|
||||
let connection_string = get_connection_string();
|
||||
|
||||
// Connect to the database
|
||||
let db = Database::connect(&connection_string)
|
||||
.await
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue