Skip to content

Commit 17e45c2

Browse files
authored
Pass all environment variables to Docker Compose (#2065)
1 parent ffacc48 commit 17e45c2

File tree

2 files changed

+15
-4
lines changed

2 files changed

+15
-4
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
- Pass all environment variables to Docker Compose

framework/components/dockercompose/chip_ingress_set/chip_ingress.go

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,11 +94,21 @@ func New(in *Input) (*Output, error) {
9494
ctx, cancel := context.WithTimeout(context.Background(), 2*time.Minute)
9595
defer cancel()
9696

97+
// Start the stackwith all environment variables from the host process
98+
// set BASIC_AUTH_ENABLED and BASIC_AUTH_PREFIX to false and empty string and allow them to be overridden by the host process
99+
envVars := make(map[string]string)
100+
envVars["BASIC_AUTH_ENABLED"] = "false"
101+
envVars["BASIC_AUTH_PREFIX"] = ""
102+
103+
for _, env := range os.Environ() {
104+
pair := strings.SplitN(env, "=", 2)
105+
if len(pair) == 2 {
106+
envVars[pair[0]] = pair[1]
107+
}
108+
}
109+
97110
upErr := stack.
98-
WithEnv(map[string]string{
99-
"BASIC_AUTH_ENABLED": "false",
100-
"BASIC_AUTH_PREFIX": "",
101-
}).
111+
WithEnv(envVars).
102112
Up(ctx)
103113

104114
if upErr != nil {

0 commit comments

Comments
 (0)