Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parse out textualize integer config paramters as integers rather than doubles #22

Merged
merged 2 commits into from Aug 7, 2014

Conversation

timmytofu
Copy link
Contributor

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

host = "database.at.my.host"
port = 5432
user = "myusername"
db = "thedbname"

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.

@timmytofu
Copy link
Contributor Author

Whoops, got some gitignore stuff in there as well....

mightybyte added a commit that referenced this pull request Aug 7, 2014
Parse out textualize integer config paramters as integers rather than doubles
@mightybyte mightybyte merged commit f114cb7 into mightybyte:master Aug 7, 2014
@mightybyte
Copy link
Owner

Nice! Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants