Parse out textualize integer config paramters as integers rather than doubles #22
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
getConnectionString
currently makes all numbers in a Configurator.Config doubles; integers end up with .0 appended to them in the generated text.Given a config file with
the generated connection string is
"host='database.at.my.host' port=5432.0 dbname='thedbname' user='myusername' "
If you use a .pgpass file, and in it you specify a port, ex:
database.at.my.host:5432:thedbname:myusername:mypassword
this parsing and generating the port as a double will kill the magic. 5432.0 doesn't match 5432, so you get an exception.
libpq: failed (fe_sendauth: no password supplied)
Granted this can be solved by making the port a * wildcard in pgpass, but I may have other reasons for specifying the port there.
Looking at the denominator and parsing denominator=1 ratios as integers this way solves that problem - not sure if it screws with anything else though (options given as integers which for whatever reason must actually be presented as a double with .0? Seems unlikely.)
Other choice is adding integer support to configurator - dunno if that's something desired, anyways. The
interpolate
function in configurator does something similar to this, though.