mirror of
https://github.com/n8n-io/n8n.git
synced 2024-11-14 16:44:07 -08:00
18 lines
543 B
Bash
Executable file
18 lines
543 B
Bash
Executable file
#!/bin/bash
|
|
set -e;
|
|
|
|
# Create a default non-root role
|
|
MONGO_NON_ROOT_ROLE="${MONGO_NON_ROOT_ROLE:-readWrite}"
|
|
|
|
if [ -n "${MONGO_NON_ROOT_USERNAME:-}" ] && [ -n "${MONGO_NON_ROOT_PASSWORD:-}" ]; then
|
|
"${mongo[@]}" "$MONGO_INITDB_DATABASE" <<-EOJS
|
|
db.createUser({
|
|
user: $(_js_escape "$MONGO_NON_ROOT_USERNAME"),
|
|
pwd: $(_js_escape "$MONGO_NON_ROOT_PASSWORD"),
|
|
roles: [ { role: $(_js_escape "$MONGO_NON_ROOT_ROLE"), db: $(_js_escape "$MONGO_INITDB_DATABASE") } ]
|
|
})
|
|
EOJS
|
|
else
|
|
echo "SETUP INFO: No Environment variables given!"
|
|
fi
|