mirror of
https://github.com/kubernetes-sigs/kustomize.git
synced 2026-06-11 17:12:51 +00:00
Introduce envs field.
This commit is contained in:
@@ -42,15 +42,14 @@ func (bf baseFactory) loadKvPairs(
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, fmt.Sprintf(
|
||||
"plugins: %s",
|
||||
args.EnvSource))
|
||||
args.KVSources))
|
||||
}
|
||||
all = append(all, pairs...)
|
||||
|
||||
pairs, err = bf.keyValuesFromEnvFile(args.EnvSource)
|
||||
pairs, err = bf.keyValuesFromEnvFiles(args.EnvSources)
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, fmt.Sprintf(
|
||||
"env source file: %s",
|
||||
args.EnvSource))
|
||||
"env source files: %v",
|
||||
args.EnvSources))
|
||||
}
|
||||
all = append(all, pairs...)
|
||||
|
||||
@@ -136,13 +135,18 @@ func (bf baseFactory) keyValuesFromFileSources(sources []string) ([]kv.Pair, err
|
||||
return kvs, nil
|
||||
}
|
||||
|
||||
func (bf baseFactory) keyValuesFromEnvFile(path string) ([]kv.Pair, error) {
|
||||
if path == "" {
|
||||
return nil, nil
|
||||
func (bf baseFactory) keyValuesFromEnvFiles(paths []string) ([]kv.Pair, error) {
|
||||
var kvs []kv.Pair
|
||||
for _, path := range paths {
|
||||
content, err := bf.ldr.Load(path)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
more, err := kv.KeyValuesFromLines(content)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
kvs = append(kvs, more...)
|
||||
}
|
||||
content, err := bf.ldr.Load(path)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return kv.KeyValuesFromLines(content)
|
||||
return kvs, nil
|
||||
}
|
||||
|
||||
@@ -99,7 +99,7 @@ func TestConstructConfigMap(t *testing.T) {
|
||||
GeneratorArgs: types.GeneratorArgs{
|
||||
Name: "envConfigMap",
|
||||
DataSources: types.DataSources{
|
||||
EnvSource: "configmap/app.env",
|
||||
EnvSources: []string{"configmap/app.env"},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
@@ -97,7 +97,7 @@ func TestConstructSecret(t *testing.T) {
|
||||
GeneratorArgs: types.GeneratorArgs{
|
||||
Name: "envSecret",
|
||||
DataSources: types.DataSources{
|
||||
EnvSource: "secret/app.env",
|
||||
EnvSources: []string{"secret/app.env"},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
@@ -32,7 +32,6 @@ type Registry struct {
|
||||
}
|
||||
|
||||
const (
|
||||
PluginSymbol = "KustomizePlugin"
|
||||
PluginRoot = "plugin"
|
||||
pluginTypeGo = types.PluginType("go")
|
||||
pluginTypeBuiltIn = types.PluginType("builtin")
|
||||
|
||||
Reference in New Issue
Block a user