Skip to content

Commit

Permalink
Added support for using environment variables to set package deployme…
Browse files Browse the repository at this point in the history
…nt variables.
  • Loading branch information
sflanker committed Feb 7, 2025
1 parent 6cf9954 commit 9345aee
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/pkg/packager/deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ package packager
import (
"context"
"fmt"
"github.com/zarf-dev/zarf/src/cmd/common"
"net/url"
"os"
"path/filepath"
Expand Down Expand Up @@ -106,6 +107,14 @@ func (p *Packager) Deploy(ctx context.Context) error {
return fmt.Errorf("deployment cancelled")
}

// Check Viper for environment variable overrides
v := common.GetViper()
for _, pkgVar := range p.cfg.Pkg.Variables {
if val := v.GetString(common.VPkgDeploySet + "." + pkgVar.Name); val != "" {
p.cfg.PkgOpts.SetVariables[pkgVar.Name] = val
}
}

if isInteractive {
p.cfg.Pkg.Components, err = deployFilter.Apply(p.cfg.Pkg)
if err != nil {
Expand Down

0 comments on commit 9345aee

Please sign in to comment.