Added MONGO_URI variable
All checks were successful
pipeline / build-and-push-images (push) Successful in 58s
pipeline / deploy (push) Successful in 23s

This commit is contained in:
2025-01-20 15:28:22 +01:00
parent 726177cccc
commit 599dd1859c
3 changed files with 15 additions and 3 deletions

View File

@@ -27,7 +27,11 @@ async function fetchLatestPatch() {
async function connectToDatabase() {
// Create a MongoClient with a MongoClientOptions object to set the Stable API version
const client = new MongoClient(`mongodb://${process.env.MONGO_USER}:${process.env.MONGO_PASS}@${process.env.MONGO_HOST}`)
let uri = `mongodb://${process.env.MONGO_USER}:${process.env.MONGO_PASS}@${process.env.MONGO_HOST}`
if(process.env.MONGO_URI != undefined && process.env.MONGO_URI != null && process.env.MONGO_URI != "") {
uri = process.env.MONGO_URI
}
const client = new MongoClient(uri)
await client.connect()
return client
}