Skip to content

Commit

Permalink
Use SecretDataKey Constants
Browse files Browse the repository at this point in the history
Signed-off-by: futuretea <[email protected]>
  • Loading branch information
futuretea committed Jun 5, 2023
1 parent 42fae06 commit 3e2e019
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ func (c *Constructor) Setup() util.Processors {
{
Field: constants.FieldCloudInitSecretUserData,
Parser: func(i interface{}) error {
c.CloudInitSecret.StringData["userdata"] = i.(string)
c.CloudInitSecret.StringData[constants.SecretDataKeyUserData] = i.(string)
return nil
},
},
Expand All @@ -40,14 +40,14 @@ func (c *Constructor) Setup() util.Processors {
if err != nil {
return fmt.Errorf("failed to decode %s string: %w", constants.FieldCloudInitSecretUserDataBase64, err)
}
c.CloudInitSecret.StringData["userdata"] = string(value)
c.CloudInitSecret.StringData[constants.SecretDataKeyUserData] = string(value)
return nil
},
},
{
Field: constants.FieldCloudInitSecretNetworkData,
Parser: func(i interface{}) error {
c.CloudInitSecret.StringData["networkdata"] = i.(string)
c.CloudInitSecret.StringData[constants.SecretDataKeyNetworkData] = i.(string)
return nil
},
},
Expand All @@ -58,7 +58,7 @@ func (c *Constructor) Setup() util.Processors {
if err != nil {
return fmt.Errorf("failed to decode %s string: %w", constants.FieldCloudInitSecretNetworkDataBase64, err)
}
c.CloudInitSecret.StringData["networkdata"] = string(value)
c.CloudInitSecret.StringData[constants.SecretDataKeyNetworkData] = string(value)
return nil
},
},
Expand Down
3 changes: 3 additions & 0 deletions pkg/constants/constants_cloudinitsecret.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,7 @@ const (
FieldCloudInitSecretNetworkData = "network_data"
FieldCloudInitSecretUserDataBase64 = "user_data_base64" // #nosec G101
FieldCloudInitSecretNetworkDataBase64 = "network_data_base64"

SecretDataKeyUserData = "userdata"
SecretDataKeyNetworkData = "networkdata"
)

0 comments on commit 3e2e019

Please sign in to comment.