From 1f1b6a1ff59fca49bfa020539f90c98afcbcfaee Mon Sep 17 00:00:00 2001
From: abduki <abdullah.kiran@student.reutlingen-university.de>
Date: Tue, 17 Dec 2024 19:32:43 +0100
Subject: [PATCH] too much shit

---
 minikube/backend.yaml                                |  3 +--
 minikube/mongodb.yaml                                | 12 ++++++------
 src/main/resources/application-instance-2.properties |  6 ------
 ...-instance-1.properties => application.properties} |  2 +-
 4 files changed, 8 insertions(+), 15 deletions(-)
 delete mode 100644 src/main/resources/application-instance-2.properties
 rename src/main/resources/{application-instance-1.properties => application.properties} (77%)

diff --git a/minikube/backend.yaml b/minikube/backend.yaml
index 47b5475..964098f 100644
--- a/minikube/backend.yaml
+++ b/minikube/backend.yaml
@@ -25,12 +25,11 @@ spec:
             - name: MONGO_PASSWORD
               value: tododbadminpassword
             - name: MONGO_HOST
-              value: mongodb-service
+              value: mongodb-service.todo.svc.cluster.local
             - name: MONGO_PORT
               value: "27017"
             - name: MONGO_DB
               value: todo
-
 ---
 apiVersion: v1
 kind: Service
diff --git a/minikube/mongodb.yaml b/minikube/mongodb.yaml
index 7298504..86bb2a2 100644
--- a/minikube/mongodb.yaml
+++ b/minikube/mongodb.yaml
@@ -44,8 +44,8 @@ apiVersion: v1
 kind: Service
 metadata:
   name: mongodb-service
+  namespace: todo
 spec:
-  clusterIP: None
   ports:
     - protocol: TCP
       port: 27017
@@ -63,10 +63,10 @@ data:
   init-mongo.js: |
     db = db.getSiblingDB('todo');
     db.createUser({
-      user: 'tododbuser',
-      pwd: 'tododbadminpassword',
+        user: 'tododbuser',
+        pwd: 'tododbadminpassword',
       roles: [
-        { role: 'userAdminAnyDatabase', db: 'todo' },
-        { role: 'readWriteAnyDatabase', db: 'todo' }
+        { role: 'readWrite', db: 'todo' },
+        { role: 'dbAdmin', db: 'todo' }
       ]
-    });
+    });
\ No newline at end of file
diff --git a/src/main/resources/application-instance-2.properties b/src/main/resources/application-instance-2.properties
deleted file mode 100644
index 410b954..0000000
--- a/src/main/resources/application-instance-2.properties
+++ /dev/null
@@ -1,6 +0,0 @@
-spring.application.name=todo
-server.port=9877
-spring.data.mongodb.uri=mongodb://${MONGO_USER}:${MONGO_PASSWORD}@${MONGO_HOST}:${MONGO_PORT}/${MONGO_DB}?authSource=admin
-
-# pattern matching für controller
-spring.mvc.pathmatch.matching-strategy=ant_path_matcher
diff --git a/src/main/resources/application-instance-1.properties b/src/main/resources/application.properties
similarity index 77%
rename from src/main/resources/application-instance-1.properties
rename to src/main/resources/application.properties
index dbfca42..3f02de2 100644
--- a/src/main/resources/application-instance-1.properties
+++ b/src/main/resources/application.properties
@@ -1,6 +1,6 @@
 spring.application.name=todo
 server.port=9876
-spring.data.mongodb.uri=mongodb://${MONGO_USER}:${MONGO_PASSWORD}@${MONGO_HOST}:${MONGO_PORT}/${MONGO_DB}?authSource=admin
+spring.data.mongodb.uri=mongodb://${MONGO_USER}:${MONGO_PASSWORD}@${MONGO_HOST}:${MONGO_PORT}/${MONGO_DB}?authSource=todo
 
 # pattern matching für controller
 spring.mvc.pathmatch.matching-strategy=ant_path_matcher
-- 
GitLab