File tree Expand file tree Collapse file tree 1 file changed +8
-7
lines changed Expand file tree Collapse file tree 1 file changed +8
-7
lines changed Original file line number Diff line number Diff line change @@ -103,23 +103,24 @@ if [ -z "$MONGODB_REPLICA_SET" ]; then
103103 exit 0
104104fi
105105
106- # For replica set mode:
107- # If auth (username/password) is requested, ensure mongodb-key is provided, otherwise generate random
108- if { [ -n " $MONGODB_USERNAME " ] || [ -n " $MONGODB_PASSWORD " ]; } && [ -z " $MONGODB_KEY " ]; then
109- MONGODB_KEY=$( dd if=/dev/urandom bs=256 count=1 2> /dev/null | base64 | tr -d ' \n' )
110- fi
111-
112106echo " ::group::Starting MongoDB as single-node replica set"
113107echo " - port [$MONGODB_PORT ]"
114108echo " - version [$MONGODB_VERSION ]"
115109echo " - replica set [$MONGODB_REPLICA_SET ]"
116110if [ -n " $MONGODB_KEY " ]; then
117111 echo " - keyFile provided: yes"
118112else
119- echo " - keyFile provided: no"
113+ echo " - keyFile provided: no (random) "
120114fi
121115echo " "
122116
117+ # For replica set mode:
118+ # If auth (username/password) is requested, ensure mongodb-key is provided, otherwise generate random
119+ if { [ -n " $MONGODB_USERNAME " ] || [ -n " $MONGODB_PASSWORD " ]; } && [ -z " $MONGODB_KEY " ]; then
120+ MONGODB_KEY=$( dd if=/dev/urandom bs=256 count=1 2> /dev/null | base64 | tr -d ' \n' )
121+ fi
122+
123+
123124# Start mongod in replica set mode, with optional auth and keyFile
124125# MONGO_INITDB_* envs will create the root user on first startup
125126
You can’t perform that action at this time.
0 commit comments