Commit acfeb3c
committed
chore: use yargs-parser to parse both CLI and ENV
Earlier we had custom code to parse ENV variable and although we were
using yargs-parser to parse CLI arguments, we were still using custom
logic to validate the parsed keys.
This commit removes the custom code entirely in favor of using
yargs-parser to parse both CLI and ENV variables while also taking care
of excluding unknown arguments. This helps remove a bunch of code that
we did not needed in the first place.
Additionally, it fixes one of the problems with positional argument
parsing. Earlier we were considering a positional argument as connection
specifier only if the deprecated flag `--connectionString` was also
passed. Now we consider the positional argument on top priority,
disregarding ENV variable, CLI arguments, etc.
This commit also splits the UserConfig schema and creation of UserConfig
for CLI entry point in two different files so that the UserConfig export
on the library don't end up pulling yargs-parser along.1 parent f7718f3 commit acfeb3c
File tree
33 files changed
+838
-821
lines changed- scripts
- src
- common
- atlas
- config
- search
- resources
- common
- telemetry
- tools
- transports
- tests
- integration
- common
- tools/mongodb
- transports
- unit
- common
- resources/common
33 files changed
+838
-821
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | | - | |
| 14 | + | |
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| |||
0 commit comments