Skip to content

Commit

Permalink
Revert to use passed in conf
Browse files Browse the repository at this point in the history
  • Loading branch information
bstrausser committed Apr 26, 2024
1 parent 1be6a31 commit 4e6c6d7
Show file tree
Hide file tree
Showing 5 changed files with 1 addition and 729 deletions.
16 changes: 0 additions & 16 deletions modules/postgres/postgres.go
Expand Up @@ -21,8 +21,6 @@ const (
)

var (
//go:embed resources/postgres-ssl.conf
embeddedConf string
//go:embed resources/customEntrypoint.sh
embeddedCustomEntrypoint string
)
Expand Down Expand Up @@ -209,23 +207,9 @@ func WithSSLSettings(sslSettings SSLSettings) testcontainers.CustomizeRequestOpt
req.WaitingFor = wait.ForAll(req.WaitingFor, wait.ForLog("database system is ready to accept connections"))

internalEntrypoint(req)
overwriteConfForSSL(req)
}
}

func overwriteConfForSSL(req *testcontainers.GenericContainerRequest) {
const confPath = "/etc/postgresql.conf"

cfgFile := testcontainers.ContainerFile{
ContainerFilePath: confPath,
FileMode: 0o755,
Reader: strings.NewReader(embeddedConf),
}

req.Files = append(req.Files, cfgFile)
req.Cmd = append(req.Cmd, "-c", "config_file=/etc/postgresql.conf")
}

func internalEntrypoint(req *testcontainers.GenericContainerRequest) {
const entrypointPath = "/usr/local/bin/docker-entrypoint-ssl.bash"

Expand Down
1 change: 1 addition & 0 deletions modules/postgres/postgres_test.go
Expand Up @@ -246,6 +246,7 @@ func TestWithSSL(t *testing.T) {
sslSettings := createSSLSettings(t)

container, err := postgres.RunContainer(ctx,
postgres.WithConfigFile(filepath.Join("testdata", "postgres-ssl.conf")),
postgres.WithInitScripts(filepath.Join("testdata", "init-user-db.sh")),
postgres.WithDatabase(dbname),
postgres.WithUsername(user),
Expand Down
22 changes: 0 additions & 22 deletions modules/postgres/testdata/docker-entrypoint-ssl.bash

This file was deleted.

0 comments on commit 4e6c6d7

Please sign in to comment.