Skip to content

Commit d45d306

Browse files
committed
default timezone for postgres to TZ=UTC
1 parent 6e64fa7 commit d45d306

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ go get -u github.com/pvormste/dockertestwrapper/v2
1414
### Postgres
1515

1616
The postgres helper function can be used to start a postgres container with default credentials/connection details.
17+
Timezone defaults to `TZ=UTC`.
1718

1819
Although it should be possible to start any postgres version with the `InitPostgresContainer` function, following
1920
images are covered by tests in this repository:

postgres.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,12 @@ func InitPostgresContainer(tag string) (*WrapperInstance, error) {
2323
userEnv := fmt.Sprintf("POSTGRES_USER=%s", DefaultPostgresUser)
2424
passwordEnv := fmt.Sprintf("POSTGRES_PASSWORD=%s", DefaultPostgresPassword)
2525
databaseEnv := fmt.Sprintf("POSTGRES_DB=%s", DefaultPostgresDatabase)
26+
timezoneEnv := fmt.Sprintf("TZ=UTC")
2627

2728
params := WrapperParams{
2829
ImageName: PostgresImageName,
2930
ImageTag: tag,
30-
EnvVariables: []string{userEnv, passwordEnv, databaseEnv},
31+
EnvVariables: []string{userEnv, passwordEnv, databaseEnv, timezoneEnv},
3132
ContainerPort: DefaultPostgresPort,
3233
AfterInitActionFunc: postgresAfterInitAction,
3334
}

0 commit comments

Comments
 (0)