miniflux / v2

Minimalist and opinionated feed reader
https://miniflux.app
Apache License 2.0
6.97k stars 727 forks source link

pq (libpq) environment variables not respected #2921

Open Kaurin opened 3 weeks ago

Kaurin commented 3 weeks ago

Hi,

pq library respects environment variables from libpq, however, these are blocked from being interpreted by this particular code intercept specific to minifux which results in:

level=INFO msg="The default value for DATABASE_URL is used"

It would be nice to let users use natively supported environment variables. My use-case certainly demands it (cloudnative-postgres in kubernetes)

fguillot commented 2 weeks ago

Only DATABASE_URL is supported at the moment.

Kaurin commented 1 week ago

I have worked around this by using an init container to generate the DATABASE_URL_FILE file.

The example provided below is for the bjw-s common library. Variable names and secret naming schema comes from cloudnative-pg

This is... quite a workaround. Support for native env vars would be very much appreciated!

    initContainers:
      a-config:
        image:
          repository: busybox
          tag: latest
        env:
          PGHOST:
            valueFrom:
              secretKeyRef:
                name: miniflux-database-app
                key: host
          PGDATABASE:
            valueFrom:
              secretKeyRef:
                name: miniflux-database-app
                key: dbname
          PGUSER:
            valueFrom:
              secretKeyRef:
                name: miniflux-database-app
                key: user
          PGPASSWORD:
            valueFrom:
              secretKeyRef:
                name: miniflux-database-app
                key: password
          PGPORT:
            valueFrom:
              secretKeyRef:
                name: miniflux-database-app
                key: port
        command:
          [
            "sh",
            "-c",
            'umask 0177 && echo "host=$PGHOST port=$PGPORT user=$PGUSER password=$PGPASSWORD dbname=$PGDATABASE sslrootcert=/libpq/tls.crt sslmode=verify-full > /libpq-config/cloudnative-pg.txt',
          ]