Skip to content

Feature Request: Enable SSL support for postgres #1113

@pjrobertson

Description

@pjrobertson

The testcontainers-go repo has an easy WithSSLSettings option (see here) that allows easily enabling SSL.

I've tried to manually enable SSL by generating and storing the certs, then copying them over to the container, but I'm not 100% there. It'd be nice if there was an easy option to enable SSL like for the go port.

Below is the code I have right now. Here's the postgres docs: https://www.postgresql.org/docs/15/ssl-tcp.html

this.container = await new PostgreSqlContainer(databaseType)
      .withDatabase(`test_db`)
      .withUsername(`postgres`)
      .withPassword(`test_pass`)
      .withCopyFilesToContainer(
        [
          {
            source: path.join(__dirname, 'server.crt'),
            target: '/var/lib/postgresql/data/server.crt',
            mode: 0o600
          },
          {
            source: path.join(__dirname, 'server.key'),
            target: '/var/lib/postgresql/data/server.key',
            mode: 0o600
          }
        ]
      )
      .start()

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions