UniFi Network Application Docker-Setup mit Update-, Backup- und Restore-Skripten
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Executable
+21
@@ -0,0 +1,21 @@
|
||||
#!/bin/bash
|
||||
# Wird nur beim allerersten Start (leeres ./data/mongodb) automatisch ausgeführt
|
||||
# und legt den Datenbank-Benutzer für die UniFi Network Application an.
|
||||
|
||||
if which mongosh > /dev/null 2>&1; then
|
||||
mongo_init_bin='mongosh'
|
||||
else
|
||||
mongo_init_bin='mongo'
|
||||
fi
|
||||
|
||||
"${mongo_init_bin}" <<EOF
|
||||
db.getSiblingDB("${MONGO_DBNAME}").createUser({
|
||||
user: "${MONGO_USER}",
|
||||
pwd: "${MONGO_PASS}",
|
||||
roles: [
|
||||
{ db: "${MONGO_DBNAME}", role: "dbOwner" },
|
||||
{ db: "${MONGO_DBNAME}_stat", role: "dbOwner" },
|
||||
{ db: "${MONGO_DBNAME}_audit", role: "dbOwner" }
|
||||
]
|
||||
})
|
||||
EOF
|
||||
Reference in New Issue
Block a user