SSL Connections in Ruby with ruby-postgres

Not much here, just a quick note about getting SSL connections to PostgreSQL in Ruby. According to the ruby-postgres documentation arbitrary libpg options can be passed to the call. Calling like this:

conn = 'host'    => '',
                    'options' => 'sslmode=require' )

results in PGError: FATAL: invalid command-line arguments for server process. After digging at some forums and the ruby-postgres source code I found that one needs to prepend the options string with -o, so a working example is:

conn = 'host'    => '',
                    'options' => '-o sslmode=require' )

Comments are closed.