Skip to content

Support more environment variables in PostgreSQL container #278

Closed

Description

@ksquaredkey

With the move from md5 to scram-sha-256 in the PostgreSQL 14.x containers, I find myself needing to set the POSTGRES_HOST_AUTH_METHOD and potentially POSTGRES_INITDB_ARGS. Seems like it would be good to flesh out the rest of the currently supported environment variables of the official PostgreSQL container. The ones not yet supported are:

  • POSTGRES_INITDB_ARGS
  • POSTGRES_INITDB_WALDIR
  • POSTGRES_HOST_AUTH_METHOD
  • PGDATA

Activity

  1. linked a pull request that will close this issueAdd new postgresql env vars (#1) #279on Feb 16, 2023
  2. added
    ✅ close on merge
    and removed on Feb 16, 2023
  3. santi commented on Mar 30, 2024

    @santi
    Contributor

    These environment variables can be set through the .with_env(<env_var>, <value>) API on the container itself. Like this:

    container = (
        PostgresContainer("postgres:16", driver="pg8000")
        .with_env("POSTGRES_INITDB_ARGS", "args here")
        .with_env("POSTGRES_INITDB_WALDIR", "args here")
    )
    with container as postgres:
        ...
  4. ksquaredkey commented on Mar 30, 2024

    @ksquaredkey
    Author

    Nice - thanks @santi ! I haven't had the cycles to come back and refactor my original PR but this is a much cleaner, flexible method, so no need.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    ✅ close on merge📦 package: postgres

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions