feat: update unifi controller

This commit is contained in:
stitchy 2025-08-13 01:45:42 -07:00
parent 3577467fb6
commit ac62e63e8e
Signed by: stitchy
SSH key fingerprint: SHA256:f7Wxv5r7Ooi4z3GxqMBx50LlPRtY/kUK/Sw8K02PYys
2 changed files with 45 additions and 3 deletions

View file

@ -0,0 +1,20 @@
#!/bin/bash
if which mongosh > /dev/null 2>&1; then
mongo_init_bin='mongosh'
else
mongo_init_bin='mongo'
fi
"${mongo_init_bin}" <<EOF
use ${MONGO_AUTHSOURCE}
db.auth("${MONGO_INITDB_ROOT_USERNAME}", "${MONGO_INITDB_ROOT_PASSWORD}")
db.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