Skip to content

Commit

Permalink
fix up encryption logger: instead if logging when init() to createCon…
Browse files Browse the repository at this point in the history
…figClient
  • Loading branch information
robynron committed Dec 1, 2023
1 parent 355c2fd commit 8646fe2
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions clients/config_client/config_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,8 @@ func NewConfigClient(nc nacos_client.INacosClient) (*ConfigClient, error) {
}

if clientConfig.OpenKMS {
filter.RegisterDefaultConfigEncryptionFilter()
nacos_inner_encryption.RegisterConfigEncryptionKmsPlugins()
var kmsClient *nacos_inner_encryption.KmsClient
switch clientConfig.KMSVersion {
case constant.KMSv1, constant.DEFAULT_KMS_VERSION:
Expand Down
2 changes: 1 addition & 1 deletion common/encryption/kms_plugins.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import (
"strings"
)

func init() {
func RegisterConfigEncryptionKmsPlugins() {
if err := GetDefaultHandler().RegisterPlugin(&KmsAes128Plugin{}); err != nil {
logger.Errorf("failed to register encryption plugin[%s] to defaultHandler", KmsAes128AlgorithmName)
} else {
Expand Down
2 changes: 1 addition & 1 deletion common/filter/config_filter.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ type IConfigFilter interface {
GetFilterName() string
}

func init() {
func RegisterDefaultConfigEncryptionFilter() {
err := RegisterConfigFilter(GetDefaultConfigFilterChainManager(), GetDefaultConfigEncryptionFilter())
if err != nil {
logger.Errorf("failed to register configFilter[%s] to DefaultConfigFilterChainManager",
Expand Down

0 comments on commit 8646fe2

Please sign in to comment.