Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 0 additions & 29 deletions config.go

This file was deleted.

11 changes: 2 additions & 9 deletions docker.go
Original file line number Diff line number Diff line change
Expand Up @@ -1493,15 +1493,8 @@ func (p *DockerProvider) RunContainer(ctx context.Context, req ContainerRequest)

// Config provides the TestcontainersConfig read from $HOME/.testcontainers.properties or
// the environment variables
func (p *DockerProvider) Config() TestcontainersConfig {
return TestcontainersConfig{
Host: p.config.Host,
TLSVerify: p.config.TLSVerify,
CertPath: p.config.CertPath,
RyukDisabled: p.config.RyukDisabled,
RyukPrivileged: p.config.RyukPrivileged,
Config: p.config,
}
func (p *DockerProvider) Config() config.Config {
return p.config
}

// DaemonHost gets the host or ip of the Docker daemon where ports are exposed on
Expand Down
2 changes: 1 addition & 1 deletion modules/compose/compose_api.go
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ func (d *DockerCompose) Up(ctx context.Context, opts ...StackUpOption) (err erro

var termSignals []chan bool
var reaper *testcontainers.Reaper
if !d.provider.Config().Config.RyukDisabled {
if !d.provider.Config().RyukDisabled {
// NewReaper is deprecated: we need to find a way to create the reaper for compose
// bypassing the deprecation.
reaper, err = testcontainers.NewReaper(ctx, testcontainers.SessionID(), d.provider, "")
Expand Down
5 changes: 3 additions & 2 deletions options.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
"github.com/docker/docker/api/types/network"

tcexec "github.com/testcontainers/testcontainers-go/exec"
"github.com/testcontainers/testcontainers-go/internal/config"
"github.com/testcontainers/testcontainers-go/internal/core"
"github.com/testcontainers/testcontainers-go/wait"
)
Expand Down Expand Up @@ -182,12 +183,12 @@ func (c CustomHubSubstitutor) Description() string {
// - if the HubImageNamePrefix configuration value is set, the image is returned as is.
func (c CustomHubSubstitutor) Substitute(image string) (string, error) {
registry := core.ExtractRegistry(image, "")
cfg := ReadConfig()
cfg := config.Read()

exclusions := []func() bool{
func() bool { return c.hub == "" },
func() bool { return registry != "" },
func() bool { return cfg.Config.HubImageNamePrefix != "" },
func() bool { return cfg.HubImageNamePrefix != "" },
}

for _, exclusion := range exclusions {
Expand Down
2 changes: 1 addition & 1 deletion provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ type ContainerProvider interface {
ReuseOrCreateContainer(context.Context, ContainerRequest) (Container, error) // reuses a container if it exists or creates a container without starting
RunContainer(context.Context, ContainerRequest) (Container, error) // create a container and start it
Health(context.Context) error
Config() TestcontainersConfig
Config() config.Config
}

// GetProvider provides the provider implementation for a certain type
Expand Down
4 changes: 2 additions & 2 deletions reaper.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ var (
// The ContainerProvider interface should usually satisfy this as well, so it is pluggable
type ReaperProvider interface {
RunContainer(ctx context.Context, req ContainerRequest) (Container, error)
Config() TestcontainersConfig
Config() config.Config
}

// NewReaper creates a Reaper with a sessionID to identify containers and a provider to use
Expand Down Expand Up @@ -377,7 +377,7 @@ func (r *reaperSpawner) newReaper(ctx context.Context, sessionID string, provide
dockerHostMount := core.MustExtractDockerSocket(ctx)

port := r.port()
tcConfig := provider.Config().Config
tcConfig := provider.Config()
req := ContainerRequest{
Image: config.ReaperDefaultImage,
ExposedPorts: []string{string(port)},
Expand Down
8 changes: 3 additions & 5 deletions reaper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,12 @@ type mockReaperProvider struct {
req ContainerRequest
hostConfig *container.HostConfig
endpointSettings map[string]*network.EndpointSettings
config TestcontainersConfig
config config.Config
}

func newMockReaperProvider(cfg config.Config) *mockReaperProvider {
m := &mockReaperProvider{
config: TestcontainersConfig{
Config: cfg,
},
config: cfg,
}

return m
Expand Down Expand Up @@ -62,7 +60,7 @@ func (m *mockReaperProvider) RunContainer(_ context.Context, req ContainerReques
return nil, errExpected
}

func (m *mockReaperProvider) Config() TestcontainersConfig {
func (m *mockReaperProvider) Config() config.Config {
return m.config
}

Expand Down
Loading