brianc/node-postgres — pull request #251 by jisaacks (2013-01-20 04:29:27+00:00)
Title: Add a method to connect with SSL 

When using Heroku and trying to connect to the DB locally you must use SSL or it will give you an error.

There was a pull request (4d15a5c05f613ee9ff71db9bde02f1833c7c589e) that allowed you to pass `ssl: true` when creating a new client, however this does not provide a way to turn on SSL when connecting via a connection string. However a connection string (verses an object of key/value pairs) is what Heroku uses.

I added the method **pg.sconnect** that does the same thing as **pg.connect** but with SSL turned on.

This allows you to connect using the ENV var set by heroku:

```javascript
var pg = require('pg');

pg.sconnect(process.env.DATABASE_URL, function(err, client) {
var query = client.query('SELECT * FROM your_table');

query.on('row', function(row) {
console.log(JSON.stringify(row));
});
});
```

Then all you would need to do to run locally is set an ENV var *DATABASE_URL*