How to enable SSL for application DB?

I am setting my DB environment variables like so:

export MB_DB_TYPE=postgres
export MB_DB_DBNAME=metabase
export MB_DB_PORT=5432
export MB_DB_USER=
export MB_DB_PASS=
export MB_DB_HOST=localhost

Is there an env variable to enable SSL as well?

Apparently there is no MB_DB_SSL but a MB_DB_CONNECTION_URI, where you can give SSL as a parameter see:

and the syntax example in

I was a bit confused about the environment var name apparently the code claims as I stated above:

When setting the MB_DB_CONNECTION_URI the application connects to H2 db.

Also if you simultaneously set MB_DB_TYPE: ??

edit: Here’s another user who got it working in December: Customizable connection string for application database setup (sslmode) (whole topic might be worth reading).

Also worth checking if your database needs some config: - can you connect to it using another client (from same place as Metabase, using SSL and does the database enforce it?)

I also had problems with ssl previously, but with the solution described in it now works fine.

1 Like