strichliste / strichliste-backend

Strichliste Backend
https://www.strichliste.org
Other
23 stars 14 forks source link

Make database configuration more flexible #77

Open m-ober opened 1 year ago

m-ober commented 1 year ago

We would like to use postgres and connect via unix socket, which is not possible right now:

doctrine:
    dbal:
        # configure these for your database server
        driver: 'pdo_mysql'
        server_version: '5.7'
        charset: utf8mb4
        default_table_options:
            charset: utf8mb4
            collate: utf8mb4_unicode_ci

        url: '%env(resolve:DATABASE_URL)%'

It seems that unix sockets are not supported when using an url to connect to a pg database (it looks like unix sockets in the url parameter are supported with mysql). And even if we don't use unix sockets, charset: utf8mb4 will break the database connection because pg does not have such charset (it's mysql specific).

I'd maybe suggest to expose more doctrine settings. This should also be backwards compatible, because if I understand it correctly the url parameter takes precedence, if set.

m-ober commented 1 year ago

/cc @mweinelt