Strapi config for PostgreSQL

updated: 17.03.2021
//~/config/env/production/database.js

module.exports = ({ env }) => ({
  defaultConnection: "default",
  connections: {
    default: {
      connector: "bookshelf",
      settings: {
        client: "postgres",
        host: env("DATABASE_HOST", "localhost"),
        port: env.int("DATABASE_PORT", 5432),
        database: env("DATABASE_NAME", "strapi"),
        username: env("DATABASE_USERNAME", "strapi"),
        password: env("DATABASE_PASSWORD", "strapi"),
        schema: "public",
        ssl: { "rejectUnauthorized": false }
      },
      options: {
      },
    },
  },
});