feat(db): add MONGO_PORT environment variable
This commit is contained in:
parent
47973a6e89
commit
9f6413ccdf
@ -8,9 +8,13 @@ pub async fn create_connection() -> Client {
|
||||
let username = var("MONGO_USERNAME").unwrap();
|
||||
let password = var("MONGO_PASSWORD").unwrap();
|
||||
let host = var("MONGO_HOST").unwrap();
|
||||
let port: u32 = var("MONGO_PORT")
|
||||
.unwrap_or("80".to_string())
|
||||
.parse()
|
||||
.expect("invalid MONGO_PORT");
|
||||
|
||||
let mut client_options = ClientOptions::parse(
|
||||
format!("mongodb+srv://{username}:{password}@{host}/?retryWrites=true&w=majority")
|
||||
format!("mongodb+srv://{username}:{password}@{host}:{port}/?retryWrites=true&w=majority")
|
||||
).await.unwrap();
|
||||
|
||||
let server_api = ServerApi::builder().version(ServerApiVersion::V1).build();
|
||||
|
Loading…
x
Reference in New Issue
Block a user