diff --git a/pkg/crypto/age.go b/pkg/crypto/age.go index e360ea41..329a1ab6 100644 --- a/pkg/crypto/age.go +++ b/pkg/crypto/age.go @@ -56,7 +56,6 @@ func (prov *AgeProvider) Marshall() ([]byte, error) { Version: "crypto.plural.sh/v1", Type: AGE, Id: prov.ID(), - Context: map[string]interface{}{}, } return yaml.Marshal(conf) diff --git a/pkg/crypto/config.go b/pkg/crypto/config.go index 46c2a13f..7c9ca161 100644 --- a/pkg/crypto/config.go +++ b/pkg/crypto/config.go @@ -13,7 +13,15 @@ type Config struct { Version string Type IdentityType Id string - Context map[string]interface{} + Context *Context +} + +type Context struct { + Key *KeyConfig `yaml:"key" json:"key"` +} + +type KeyConfig struct { + File string } func configPath() string { diff --git a/pkg/crypto/key.go b/pkg/crypto/key.go index 4c932b8b..4b06ca54 100644 --- a/pkg/crypto/key.go +++ b/pkg/crypto/key.go @@ -10,6 +10,7 @@ import ( "os" "path/filepath" + "github.com/mitchellh/go-homedir" "github.com/pluralsh/plural/pkg/utils" "github.com/pluralsh/plural/pkg/utils/pathing" "gopkg.in/yaml.v2" @@ -39,13 +40,20 @@ func (prov *KeyProvider) Marshall() ([]byte, error) { Version: "crypto.plural.sh/v1", Type: KEY, Id: prov.ID(), - Context: map[string]interface{}{}, } return yaml.Marshal(conf) } func buildKeyProvider(conf *Config, key *AESKey) (prov *KeyProvider, err error) { + if conf.Context != nil && conf.Context.Key != nil { + if file, err := homedir.Expand(conf.Context.Key.File); err == nil { + if k, err := Read(file); err == nil { + key = k + } + } + } + prov = &KeyProvider{key: key.Key} if prov.ID() != conf.Id { err = fmt.Errorf("the key fingerprints failed to match") diff --git a/pkg/scaffold/helm.go b/pkg/scaffold/helm.go index f6f8b51d..f945f7b0 100644 --- a/pkg/scaffold/helm.go +++ b/pkg/scaffold/helm.go @@ -5,6 +5,7 @@ import ( "fmt" "os" "path/filepath" + "sort" "strings" ttpl "text/template" @@ -62,6 +63,9 @@ func (s *Scaffold) chartDependencies(w *wkspace.Workspace) []dependency { fmt.Sprintf("%s.enabled", chartInstallation.Chart.Name), } } + sort.SliceStable(dependencies, func(i, j int) bool { + return dependencies[i].Name < dependencies[j].Name + }) return dependencies }