datamapper / do

DataObjects
147 stars 74 forks source link

do_postgres needs ssl options support #59

Open claco opened 11 years ago

claco commented 11 years ago

I'm currently using dm/do to connect to a postgresql server with ssl enabled with enforced client certificates.

After scouring the internet and finding the mysql ssl settings in the wiki (https://github.com/datamapper/do/wiki/MySQL), it seems that no such options exist for do_postgres.

Luckily, the low level driver will still happily use ENV variables set in ruby, but passing these in the hash (or on the url like connection string) would be ideal.

For the sake of reference:

Here's a sample pgsql command like from 9.2 with the newer style connection string options:

psql "sslmode=verify-ca user=myuser hostaddr=10.10.10.40 dbname=mydb sslcert=/srv/postgresql/client.crt sslkey=/srv/postgresql/client.key sslrootcert=/srv/postgresql/ca.crt"

Here are the relevant ENV/connection string variables for SSL connections from http://www.postgresql.org/docs/9.2/static/libpq-envars.html: