Skip to content

Commit 11744da

Browse files
authored
Merge pull request #591 from infosiftr/revert-ini-config-check
Revert ignoring ini-style config
2 parents 9ba7eb0 + fe7b66f commit 11744da

File tree

5 files changed

+50
-0
lines changed

5 files changed

+50
-0
lines changed

4.2/docker-entrypoint.sh

Lines changed: 10 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

4.4/docker-entrypoint.sh

Lines changed: 10 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

5.0/docker-entrypoint.sh

Lines changed: 10 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

6.0/docker-entrypoint.sh

Lines changed: 10 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docker-entrypoint.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,16 @@ _parse_config() {
184184
if configPath="$(_mongod_hack_get_arg_val --config "$@")" && [ -s "$configPath" ]; then
185185
# if --config is specified, parse it into a JSON file so we can remove a few problematic keys (especially SSL-related keys)
186186
# see https://docs.mongodb.com/manual/reference/configuration-options/
187+
if grep -vEm1 '^[[:space:]]*(#|$)' "$configPath" | grep -qE '^[[:space:]]*[^=:]+[[:space:]]*='; then
188+
# if the first non-comment/non-blank line of the config file looks like "foo = ...", this is probably the 2.4 and older "ini-style config format"
189+
# mongod tries to parse config as yaml and then falls back to ini-style parsing
190+
# https://github.com/mongodb/mongo/blob/r6.0.3/src/mongo/util/options_parser/options_parser.cpp#L1883-L1894
191+
echo >&2
192+
echo >&2 "WARNING: it appears that '$configPath' is in the older INI-style format (replaced by YAML in MongoDB 2.6)"
193+
echo >&2 ' This script does not parse the older INI-style format, and thus will ignore it.'
194+
echo >&2
195+
return 1
196+
fi
187197
if [ "$mongoShell" = 'mongo' ]; then
188198
"$mongoShell" --norc --nodb --quiet --eval "load('/js-yaml.js'); printjson(jsyaml.load(cat($(_js_escape "$configPath"))))" > "$jsonConfigFile"
189199
else

0 commit comments

Comments
 (0)