Problem connecting to postgres docker container using npm run develop command, strapi using windows authentication

Hi Eventyret,

The problem is partially solved. I dont seem to be able to pass the connection string using .env variable but when i hardcode the string into the connection object it works fine. So this works:

        connection: {
        connectionString: 'postgresql://strapi:strapi@localhost/plnr?sslmode=disable',
        //connectionString: env('DATABASE_URL'),
        host: env('DATABASE_HOST', 'localhost'),
        port: env.int('DATABASE_PORT', 5432),
        database: env('DATABASE_NAME', 'strapi'),
        user: env('DATABASE_USERNAME', 'strapi'),
        password: env('DATABASE_PASSWORD', 'strapi'),
        ssl: env.bool('DATABASE_SSL', false) && {
          key: env('DATABASE_SSL_KEY', undefined),
          cert: env('DATABASE_SSL_CERT', undefined),
          ca: env('DATABASE_SSL_CA', undefined),
          capath: env('DATABASE_SSL_CAPATH', undefined),
          cipher: env('DATABASE_SSL_CIPHER', undefined),
          rejectUnauthorized: env.bool(
            'DATABASE_SSL_REJECT_UNAUTHORIZED',
            true
          ),
        },
        schema: env('DATABASE_SCHEMA', 'public'),
      },

But string in the env file like this:

...
# Database
DATABASE_URL=postgresql://strapi:strapi@localhost/plnr?sslmode=disable
DATABASE_CLIENT=postgres
DATABASE_HOST=localhost
DATABASE_PORT=5432
DATABASE_NAME=plnr
DATABASE_USERNAME=strapi
DATABASE_PASSWORD=strapi
DATABASE_SSL=false
...

with connectionString: env('DATABASE_URL'), in connection object does not work. Which is fine for development purposes but will break our preferred deployment process.

Thanks for your attention.

1 Like