Open pbolduc opened 1 year ago
I did a quick check of the Knex typescript interfaces, and it seems like their example of rejectUnauthorized
is a MariaDB specific parameter. The Knex config uses the Config
interface, which can take in an optional StaticConnectionConfig
interface, which unions a bunch of configuration types - notably MariaSqlConnectionConfig
and PgConnectionConfig
. Both of those interfaces do accept an optional ssl boolean or object attribute, but tracking down rejectUnauthorized
it appears to be under just the MariaSslConfiguration
interface; it does not appear under PgConnectionConfig
interface, which leads to the generic TLS ConnectionOptions
interface provided by node. I'm going to go ahead and slip in the recommended line based on their documentation recommendation and hope that is sufficient for enabling TLS support.
I was thinking about making it easier by just allowing setting the connecting string directly instead of the fields as Knex allows,
module.exports = {
client: 'pg',
connection: {
// connectionString is highest priority to use. If left unspecified then connection
// details will be determined using the individual connection fields (host, port, etc)
connectionString: config.get('db.connectionString'),
host: config.get('db.host'),
user: config.get('db.username'),
password: config.get('db.password'),
database: config.get('db.database'),
port: config.get('db.port')
},
"db": {
"connectionString": "DB_CONNECTION_STRING",
"database": "DB_DATABASE",
"host": "DB_HOST",
"password": "DB_PASSWORD",
"poolMin": "DB_POOL_MIN",
"poolMax": "DB_POOL_MAX",
"port": "DB_PORT",
"username": "DB_USERNAME"
},
We can consider exposing the connectionString for a release after v0.7.0. However, if we were to proceed with this, this would also need a full implementation into the existing helm chart to ensure that the optionality behavior of the connectionString (specifically ensuring that we are optionally taking in a connection string via secret insertion, and only putting in the variable lookup in the deploymentconfig when it exists, as well as excluding out the other db.* values safely). We'll add this to our backlog for consideration thank you.
Is your feature request related to a problem? Please describe.
I am trying to use the Crunchy Postgres Operator (PGO) for deploying Postgres. PGO enforces that all connections are over TLS. In the current version, there appears no way to configure SSL. Knexjs allows setting the SSL settings - https://knexjs.org/guide/#configuration-options. For example,
The following file would need the extra ssl property.
Without being able to enable the SSL, I get the following error when COMS tries to connect to the database.
The pg_hba.conf is
Version Number
I am still on 0.4.2, however, looking at the latest version, 0.6.0 it does not appear to support SSL.
Describe the solution you'd like
I would like to enable ssl when connecting to Postgres.
Describe alternatives you've considered
none
Additional context
n/a