Skip to content
This repository was archived by the owner on Jun 26, 2023. It is now read-only.

Commit 397fa63

Browse files
committed
docker-compose does not have --config option, so use env var
1 parent bf52517 commit 397fa63

File tree

2 files changed

+9
-10
lines changed

2 files changed

+9
-10
lines changed

compose/internal/composeplugin/composeplugin.go

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"bytes"
55
"context"
66
"log"
7+
"os"
78
"os/exec"
89
"strings"
910

@@ -95,16 +96,18 @@ func (wrapper *PluginWrapper) command(command composeCommand, workingDir, host,
9596
var stderr bytes.Buffer
9697

9798
args := []string{}
98-
99-
if wrapper.configPath != "" {
100-
args = append(args, "--config", wrapper.configPath)
101-
}
102-
10399
args = append(args, command.ToArgs()...)
104100

105101
cmd := exec.Command(program, args...)
106102
cmd.Dir = workingDir
107103

104+
if wrapper.configPath != "" {
105+
if wrapper.configPath != "" {
106+
cmd.Env = os.Environ()
107+
cmd.Env = append(cmd.Env, "DOCKER_CONFIG="+wrapper.configPath)
108+
}
109+
}
110+
108111
cmd.Stderr = &stderr
109112

110113
output, err := cmd.Output()
@@ -148,10 +151,6 @@ func newPullCommand(filePaths []string) composeCommand {
148151
return newCommand([]string{"pull"}, filePaths)
149152
}
150153

151-
func (command *composeCommand) WithConfigPath(configPath string) {
152-
command.args = append(command.args, "--config", configPath)
153-
}
154-
155154
func (command *composeCommand) WithProjectName(projectName string) {
156155
command.args = append(command.args, "-p", projectName)
157156
}

libstack.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import (
55
)
66

77
type Deployer interface {
8-
Deploy(ctx context.Context, workingDir, host, projectName string, filePaths []string, envFilePath string, forceRereate bool) error
8+
Deploy(ctx context.Context, workingDir, host, projectName string, filePaths []string, envFilePath string, forceRecreate bool) error
99
Remove(ctx context.Context, workingDir, host, projectName string, filePaths []string, envFilePath string) error
1010
Pull(ctx context.Context, workingDir, host, projectName string, filePaths []string, envFilePath string) error
1111
}

0 commit comments

Comments
 (0)