Allow WithEnv to be passed multiple times

Signed-off-by: Kristoffer Dalby <kristoffer@tailscale.com>
This commit is contained in:
Kristoffer Dalby 2022-11-24 16:35:30 +01:00 committed by Kristoffer Dalby
parent d71aef3b98
commit 91ed6e2197

View file

@ -79,13 +79,9 @@ func WithTLS() Option {
func WithConfigEnv(configEnv map[string]string) Option { func WithConfigEnv(configEnv map[string]string) Option {
return func(hsic *HeadscaleInContainer) { return func(hsic *HeadscaleInContainer) {
env := []string{}
for key, value := range configEnv { for key, value := range configEnv {
env = append(env, fmt.Sprintf("%s=%s", key, value)) hsic.env = append(hsic.env, fmt.Sprintf("%s=%s", key, value))
} }
hsic.env = env
} }
} }