How can I set my connection's ssl property to true when I'm using a connection string to initialize knex? Similarly how to set the debug to true? I would normally pass in a connection object but in this case I have to use a connection string from environment variables.
var database = {
client: 'pg',
connection: connstr //normally I would pass in the object below
//connection: {
// "host": config.get('database_host'),
// "user": config.get('database_user'),
// "password": config.get('database_password'),
// "database": config.get('database_name'),
// "debug": config.get('database_debug'),
// "ssl":config.get('database_ssl')
//}
};
var knex = require('knex')(database);
knex.connection.ssl = true; // this doesn't seem to do anything
Simply add
?ssl=true
to the end of your connection string (at the end of the database name). For debug, either append?debug=true
after setting ssl or&debug=true
I'm actually not sure sorry so just try both.