Skip to content

Commit 5e5d7ec

Browse files
authored
Lookup local secret from env if needed (#1349)
1 parent 0d11ae1 commit 5e5d7ec

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

schemaregistry/rules/encryption/localkms/local_driver.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import (
2424
"github.com/tink-crypto/tink-go/v2/core/registry"
2525
"github.com/tink-crypto/tink-go/v2/subtle"
2626
"google.golang.org/protobuf/proto"
27+
"os"
2728
"strings"
2829

2930
agpb "github.com/tink-crypto/tink-go/v2/proto/aes_gcm_go_proto"
@@ -57,8 +58,11 @@ func (l *localDriver) NewKMSClient(config map[string]string, keyURL *string) (re
5758
if keyURL != nil {
5859
uriPrefix = *keyURL
5960
}
60-
secretKey, ok := config[secret]
61-
if !ok {
61+
secretKey := config[secret]
62+
if secretKey == "" {
63+
secretKey = os.Getenv("LOCAL_SECRET")
64+
}
65+
if secretKey == "" {
6266
return nil, errors.New("cannot load secret")
6367
}
6468
return NewLocalClient(uriPrefix, secretKey)

0 commit comments

Comments
 (0)