mirror of
https://github.com/getsops/sops.git
synced 2026-02-05 12:45:21 +01:00
refactor: remove GetHckmsKeys() helper and use HCKms field directly
Signed-off-by: Enbiya Goral <100806254+enbiyagoral@users.noreply.github.com>
This commit is contained in:
@@ -179,9 +179,9 @@ type creationRule struct {
|
||||
PathRegex string `yaml:"path_regex"`
|
||||
KMS interface{} `yaml:"kms"` // string or []string
|
||||
AwsProfile string `yaml:"aws_profile"`
|
||||
Age interface{} `yaml:"age"` // string or []string
|
||||
PGP interface{} `yaml:"pgp"` // string or []string
|
||||
GCPKMS interface{} `yaml:"gcp_kms"` // string or []string
|
||||
Age interface{} `yaml:"age"` // string or []string
|
||||
PGP interface{} `yaml:"pgp"` // string or []string
|
||||
GCPKMS interface{} `yaml:"gcp_kms"` // string or []string
|
||||
HCKms []string `yaml:"hckms"`
|
||||
AzureKeyVault interface{} `yaml:"azure_keyvault"` // string or []string
|
||||
VaultURI interface{} `yaml:"hc_vault_transit_uri"` // string or []string
|
||||
@@ -221,10 +221,6 @@ func (c *creationRule) GetVaultURIs() ([]string, error) {
|
||||
return parseKeyField(c.VaultURI, "hc_vault_transit_uri")
|
||||
}
|
||||
|
||||
func (c *creationRule) GetHckmsKeys() ([]string, error) {
|
||||
return c.HCKms, nil
|
||||
}
|
||||
|
||||
// Utility function to handle both string and []string
|
||||
func parseKeyField(field interface{}, fieldName string) ([]string, error) {
|
||||
if field == nil {
|
||||
@@ -420,11 +416,7 @@ func getKeyGroupsFromCreationRule(cRule *creationRule, kmsEncryptionContext map[
|
||||
for _, k := range gcpkms.MasterKeysFromResourceIDString(strings.Join(gcpkmsKeys, ",")) {
|
||||
keyGroup = append(keyGroup, k)
|
||||
}
|
||||
hckmsKeys, err := getKeysWithValidation(cRule.GetHckmsKeys, "hckms")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
hckmsMasterKeys, err := hckms.NewMasterKeyFromKeyIDString(strings.Join(hckmsKeys, ","))
|
||||
hckmsMasterKeys, err := hckms.NewMasterKeyFromKeyIDString(strings.Join(cRule.HCKms, ","))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user