Set meaningful message from minio with env variable KMS_SECRET_KEY (#16584)

This commit is contained in:
Allan Roger Reid
2023-02-21 17:43:01 -08:00
committed by GitHub
parent fd6622458b
commit 8bfe972bab
11 changed files with 304 additions and 216 deletions

View File

@@ -28,6 +28,7 @@ import (
"github.com/minio/kes-go"
"github.com/minio/pkg/certs"
"github.com/minio/pkg/env"
)
const (
@@ -189,6 +190,26 @@ func (c *kesClient) Stat(ctx context.Context) (Status, error) {
}, nil
}
// IsLocal returns true if the KMS is a local implementation
func (c *kesClient) IsLocal() bool {
return env.IsSet(EnvKMSSecretKey)
}
// List returns an array of local KMS Names
func (c *kesClient) List() []kes.KeyInfo {
var kmsSecret []kes.KeyInfo
envKMSSecretKey := env.Get(EnvKMSSecretKey, "")
values := strings.SplitN(envKMSSecretKey, ":", 2)
if len(values) == 2 {
kmsSecret = []kes.KeyInfo{
{
Name: values[0],
},
}
}
return kmsSecret
}
// Metrics retrieves server metrics in the Prometheus exposition format.
func (c *kesClient) Metrics(ctx context.Context) (kes.Metric, error) {
c.lock.RLock()