set configScanDir as package scoped var (#264)

set config.Install.env variables in environment

adding env to config to use across all stages

switch to config.Scan to read config
This commit is contained in:
Santhosh
2022-10-24 16:43:23 +05:30
committed by Itxaka
parent 5177492f57
commit fd39b2fa79
2 changed files with 17 additions and 0 deletions

View File

@@ -40,6 +40,7 @@ type Config struct {
FailOnBundleErrors bool `yaml:"fail_on_bundles_errors,omitempty"` FailOnBundleErrors bool `yaml:"fail_on_bundles_errors,omitempty"`
Bundles Bundles `yaml:"bundles,omitempty"` Bundles Bundles `yaml:"bundles,omitempty"`
GrubOptions map[string]string `yaml:"grub_options,omitempty"` GrubOptions map[string]string `yaml:"grub_options,omitempty"`
Env []string `yaml:"env,omitempty"`
} }
type Bundles []Bundle type Bundles []Bundle

16
pkg/utils/env.go Normal file
View File

@@ -0,0 +1,16 @@
package utils
import (
"os"
"strings"
)
func SetEnv(env []string) {
for _, e := range env {
pair := strings.SplitN(e, "=", 2)
if len(pair) >= 2 {
os.Setenv(pair[0], pair[1])
}
}
}