Skip to content

Commit

Permalink
Merge pull request #341 from infosiftr/configsvr
Browse files Browse the repository at this point in the history
Update _dbPath function to account for running as a config server
  • Loading branch information
tianon committed Mar 27, 2019
2 parents 6f010d8 + e0b3c10 commit 86974ba
Show file tree
Hide file tree
Showing 5 changed files with 60 additions and 0 deletions.
12 changes: 12 additions & 0 deletions 3.4/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,18 @@ _dbPath() {
fi
fi

if [ -z "$dbPath" ]; then
if _mongod_hack_have_arg --configsvr "$@" || {
_parse_config "$@" \
&& clusterRole="$(jq -r '.sharding.clusterRole // empty' "$jsonConfigFile")" \
&& [ "$clusterRole" = 'configsvr']
}; then
# if running as config server, then the default dbpath is /data/configdb
# https://docs.mongodb.com/manual/reference/program/mongod/#cmdoption-mongod-configsvr
dbPath=/data/configdb
fi
fi

: "${dbPath:=/data/db}"

echo "$dbPath"
Expand Down
12 changes: 12 additions & 0 deletions 3.6/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,18 @@ _dbPath() {
fi
fi

if [ -z "$dbPath" ]; then
if _mongod_hack_have_arg --configsvr "$@" || {
_parse_config "$@" \
&& clusterRole="$(jq -r '.sharding.clusterRole // empty' "$jsonConfigFile")" \
&& [ "$clusterRole" = 'configsvr']
}; then
# if running as config server, then the default dbpath is /data/configdb
# https://docs.mongodb.com/manual/reference/program/mongod/#cmdoption-mongod-configsvr
dbPath=/data/configdb
fi
fi

: "${dbPath:=/data/db}"

echo "$dbPath"
Expand Down
12 changes: 12 additions & 0 deletions 4.0/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,18 @@ _dbPath() {
fi
fi

if [ -z "$dbPath" ]; then
if _mongod_hack_have_arg --configsvr "$@" || {
_parse_config "$@" \
&& clusterRole="$(jq -r '.sharding.clusterRole // empty' "$jsonConfigFile")" \
&& [ "$clusterRole" = 'configsvr']
}; then
# if running as config server, then the default dbpath is /data/configdb
# https://docs.mongodb.com/manual/reference/program/mongod/#cmdoption-mongod-configsvr
dbPath=/data/configdb
fi
fi

: "${dbPath:=/data/db}"

echo "$dbPath"
Expand Down
12 changes: 12 additions & 0 deletions 4.1/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,18 @@ _dbPath() {
fi
fi

if [ -z "$dbPath" ]; then
if _mongod_hack_have_arg --configsvr "$@" || {
_parse_config "$@" \
&& clusterRole="$(jq -r '.sharding.clusterRole // empty' "$jsonConfigFile")" \
&& [ "$clusterRole" = 'configsvr']
}; then
# if running as config server, then the default dbpath is /data/configdb
# https://docs.mongodb.com/manual/reference/program/mongod/#cmdoption-mongod-configsvr
dbPath=/data/configdb
fi
fi

: "${dbPath:=/data/db}"

echo "$dbPath"
Expand Down
12 changes: 12 additions & 0 deletions docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,18 @@ _dbPath() {
fi
fi

if [ -z "$dbPath" ]; then
if _mongod_hack_have_arg --configsvr "$@" || {
_parse_config "$@" \
&& clusterRole="$(jq -r '.sharding.clusterRole // empty' "$jsonConfigFile")" \
&& [ "$clusterRole" = 'configsvr']
}; then
# if running as config server, then the default dbpath is /data/configdb
# https://docs.mongodb.com/manual/reference/program/mongod/#cmdoption-mongod-configsvr
dbPath=/data/configdb
fi
fi

: "${dbPath:=/data/db}"

echo "$dbPath"
Expand Down

0 comments on commit 86974ba

Please sign in to comment.