From b33e155709383ad77a3bbd73306e0ab643a3d35a Mon Sep 17 00:00:00 2001 From: Earl Warren Date: Fri, 15 Nov 2024 22:33:36 +0100 Subject: fix: make container.docker_host default to - (part two) If --config is not specified, the default must also be "-" and not "" --- internal/pkg/config/config.go | 4 ++++ internal/pkg/config/config_test.go | 1 + 2 files changed, 5 insertions(+) (limited to 'internal') diff --git a/internal/pkg/config/config.go b/internal/pkg/config/config.go index 5ab177d..60be651 100644 --- a/internal/pkg/config/config.go +++ b/internal/pkg/config/config.go @@ -153,6 +153,10 @@ func LoadDefault(file string) (*Config, error) { cfg.Runner.ReportInterval = time.Second } + if cfg.Container.DockerHost == "" { + cfg.Container.DockerHost = "-" + } + // although `container.network_mode` will be deprecated, but we have to be compatible with it for now. if cfg.Container.NetworkMode != "" && cfg.Container.Network == "" { log.Warn("You are trying to use deprecated configuration item of `container.network_mode`, please use `container.network` instead.") diff --git a/internal/pkg/config/config_test.go b/internal/pkg/config/config_test.go index af3ebf7..2f046c0 100644 --- a/internal/pkg/config/config_test.go +++ b/internal/pkg/config/config_test.go @@ -40,5 +40,6 @@ func TestDefaultSettings(t *testing.T) { config, err := LoadDefault("") assert.NoError(t, err) + assert.EqualValues(t, config.Container.DockerHost, "-") assert.EqualValues(t, config.Log.JobLevel, "info") } -- cgit v1.2.3