We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent c9a7138 commit c8dd223Copy full SHA for c8dd223
examples/init-mongo.js
@@ -1,8 +1,12 @@
1
-// This is only for initializing the db and creating the mailauth user
+const PASSWORD = process.env.MONGO_PW
2
+const USER = process.env.MONGO_USER
3
+const DB = process.env.MONGO_INITDB_DATABASE
4
-db = db.getSiblingDB("mailauth")
5
+db = db.getSiblingDB(DB) // Switch to your target database
6
db.createUser({
- user: "mailauth",
- pwd: "SECURE_PW", // This should match the one in your env
7
- roles: [{ role: "readWrite", db: "mailauth" }],
+ user: USER,
8
+ pwd: PASSWORD,
9
+ roles: [
10
+ { role: "readWrite", db: DB }, // Give read/write access to 'mailauth'
11
+ ],
12
})
0 commit comments