Remove DB settings from settings service

This commit is contained in:
Alex Holliday committed 2025-05-08 13:11:51 -07:00
1 parent c466edb751
commit 91c2f7f0d5
6 files changed
+24 -86

No files matched your search

+3 -3
View File
@@ -76,7 +76,8 @@ import * as diagnosticModule from "./modules/diagnosticModule.js";
class MongoDB {
static SERVICE_NAME = "MongoDB";
constructor() {
constructor({ appSettings }) {
this.appSettings = appSettings;
Object.assign(this, userModule);
Object.assign(this, inviteModule);
Object.assign(this, recoveryModule);
@@ -95,8 +96,7 @@ class MongoDB {
connect = async () => {
try {
const connectionString =
process.env.DB_CONNECTION_STRING || "mongodb://localhost:27017/uptime_db";
console.log("Connecting to MongoDB with connection string:", connectionString);
this.appSettings.dbConnectionString || "mongodb://localhost:27017/uptime_db";
await mongoose.connect(connectionString);
// If there are no AppSettings, create one
await AppSettings.findOneAndUpdate(
+2 -1
View File
@@ -14,10 +14,11 @@ const getAppSettings = async () => {
const updateAppSettings = async (newSettings) => {
try {
console.log(newSettings);
const settings = await AppSettings.findOneAndUpdate(
{},
{ $set: newSettings },
{ new: true }
{ new: true, upsert: true }
);
return settings;
} catch (error) {