Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 1 addition & 7 deletions engine/appconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import (
"os"

"github.com/project-flogo/core/app"
"github.com/project-flogo/core/engine/secret"
"github.com/project-flogo/core/support"
)

Expand Down Expand Up @@ -58,13 +57,8 @@ func LoadAppConfig(flogoJson string, compressed bool) (*app.Config, error) {
}
}

updated, err := secret.PreProcessConfig(jsonBytes)
if err != nil {
return nil, err
}

appConfig := &app.Config{}
err = json.Unmarshal(updated, &appConfig)
err := json.Unmarshal(jsonBytes, &appConfig)
if err != nil {
return nil, err
}
Expand Down
17 changes: 0 additions & 17 deletions engine/secret/config.go
Original file line number Diff line number Diff line change
@@ -1,26 +1,9 @@
package secret

import (
"regexp"
"strings"
)

func PreProcessConfig(appJson []byte) ([]byte, error) {

// For now decode secret values
re := regexp.MustCompile("SECRET:[^\\\\\"]*")
for _, match := range re.FindAll(appJson, -1) {
decodedValue, err := resolveSecretValue(string(match))
if err != nil {
return nil, err
}
appstring := strings.Replace(string(appJson), string(match), decodedValue, -1)
appJson = []byte(appstring)
}

return appJson, nil
}

func resolveSecretValue(encrypted string) (string, error) {
encodedValue := string(encrypted[7:])
decodedValue, err := GetSecretValueHandler().DecodeValue(encodedValue)
Expand Down