-
Type: Task
-
Resolution: Fixed
-
Priority: Major - P3
-
Affects Version/s: None
-
Component/s: mongo-tools-common
-
None
Tools need to generate a URI from various host/port combinations:
noformat
--host foo # single host
--host foo --port 27017 # single host and port
--host foo,bar # multiple host
--host foo,bar --port 27107 # multiple host plus port
--host foo:27017,bar:27107 # multiple host/port pair (but maybe invalid without repl set name?)
- For all the above, host can be prefixed with a replica set name
--host setname/foo,bar --port 27107
- It's also possible to specify a port by itself
--port 33333
Logic to handle this is scattered, including:
- options/options.go (ParseArgs)
- db/db.go (configureClient)
- helpers in util/mongo.go
These should all be centralized and rationalized to convert any host/port combination into the expected URI and there should be unit testing for the conversions.