-
Type: Bug
-
Resolution: Unresolved
-
Priority: Minor - P4
-
None
-
Affects Version/s: 100.0.0
-
Component/s: None
-
None
The current implementation of TOOLS-2459 doesn't throw a conflict in all the cases that it should. This is because the way we are using the go-flags package means we can't tell for sure if an option has been set or not. The closest approximation is by checking if the option is different from its default value. But this causes an issue if a user intentionally set the default value of an option.
For example the following combination of arguments would not throw an error even though clearly there has been a mistake:
--dialTimeout 3 --uri="mongodb://foo/?connectTimeoutMS=5000"
--compressors none --uri="mongodb://foo/?compressors=snappy"
--ssl false --uri="mongodb://foo/?tls=true"
There are several possible solutions to this:
- Use pointers for all option values.
- Use go-flags' Command objects so we have access to their Option type. This type can tell us whether or not it has been set.
- Use a custom option type.
- Switch to a different CLI framework such as spf13/cobra or urfave/cli (probably a bit drastic).
- related to
-
TOOLS-2459 Allow --uri to be used with other connection string options
- Closed
-
TOOLS-2585 Simplify normalization logic for URI options and command line options
- Accepted