ODK Central with custom database with SSL

Thanks for sharing your attempts, @Florian_May!

Just to keep things linked, I'll note that this relates to this GitHub issue and this forum topic.

And as background, one issue here is that Knex and Slonik connect to the database in very different ways. (We used Knex before v1.2 and now use Slonik.) Knex uses a configuration object that supports many options. On the other hand, Slonik uses a connection string. The Central database config continues to be an object, but internally, it is converted to a connection string before being passed to Slonik. That conversion will use only a subset of the options that Knex supported and will ignore the ssl option.

That's probably part of the reason why attempt 3 doesn't work. (Though I'm not sure why the logs don't show errors.)

As for attempt 4, the pg package seems to support ssl=no-verify. However, Slonik doesn't seem to pass the connection string directly to pg. Instead, it seems to use the pg-connection-string package to parse the connection string, and pg-connection-string doesn't seem to support ssl=no-verify. One intriguing option that I haven't looked much into is that pg-connection-string seems to have a similar option to ssl=no-verify: sslmode=no-verify. And interestingly, in most cases where SSL options are specified, Slonik itself seems to specify false for rejectUnauthorized. Given that, I'm slightly surprised that ssl=true and ssl=1 don't work.

I'm realizing that while we now mostly use Slonik, we actually do still use Knex for database migrations. I think we pass the database config directly to Knex without first converting it to a connection string, which is probably why appending parameters doesn't work in some cases. Actually, I'm now a little surprised that that approach did work in the other forum topic.

Out of curiosity, for attempt 5, did you specify the environment variable in addition to ssl=no-verify or instead of ssl=no-verify? What happens if you specify the environment variable without specifying a value for ssl?