make environment variable interpolation preprocessor optional (#1715)

This commit is contained in:
Colin Hoglund
2020-07-06 15:13:35 -04:00
committed by GitHub
parent 97ae2979ad
commit 90dca65f55
5 changed files with 62 additions and 12 deletions

View File

@@ -21,9 +21,14 @@ type jsonValue struct {
*simple.Json
}
func newValues(ch *source.ChangeSet) (reader.Values, error) {
func newValues(ch *source.ChangeSet, opts reader.Options) (reader.Values, error) {
sj := simple.New()
data, _ := reader.ReplaceEnvVars(ch.Data)
data := ch.Data
if !opts.DisableReplaceEnvVars {
data, _ = reader.ReplaceEnvVars(ch.Data)
}
if err := sj.UnmarshalJSON(data); err != nil {
sj.SetPath(nil, string(ch.Data))
}