Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pq (libpq) environment variables not respected #2921

Open
Kaurin opened this issue Oct 31, 2024 · 2 comments
Open

pq (libpq) environment variables not respected #2921

Kaurin opened this issue Oct 31, 2024 · 2 comments
Labels

Comments

@Kaurin
Copy link

Kaurin commented Oct 31, 2024

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
Copy link
Member

fguillot commented Nov 4, 2024

Only DATABASE_URL is supported at the moment.

@Kaurin
Copy link
Author

Kaurin commented Nov 9, 2024

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',
          ]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

2 participants