Skip to content

Commit

Permalink
Nacos AMC or KMS
Browse files Browse the repository at this point in the history
  • Loading branch information
yoyofx committed Jun 1, 2021
1 parent 66c4e16 commit badd664
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 0 deletions.
5 changes: 5 additions & 0 deletions example_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,8 @@ yoyogo:
enable: true
username: "root"
password: "1234"
endpoint: ""
regionId: ""
accessKey: ""
secretKey: ""
openKMS: false
6 changes: 6 additions & 0 deletions nacos_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,15 @@ func NewNacosConfigManager(option *Option) (*nacosConfigManager, error) {
MaxAge: 3,
LogLevel: "info",
}

if option.Auth != nil && option.Auth.Enable {
clientConfig.Username = option.Auth.User
clientConfig.Password = option.Auth.Password
clientConfig.Endpoint = option.Auth.Endpoint
clientConfig.RegionId = option.Auth.RegionId
clientConfig.AccessKey = option.Auth.AccessKey
clientConfig.SecretKey = option.Auth.SecretKey
clientConfig.OpenKMS = option.Auth.OpenKMS
}
client, err := clients.CreateConfigClient(map[string]interface{}{
"serverConfigs": serverConfigs,
Expand Down
11 changes: 11 additions & 0 deletions nacos_options.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,15 @@ type Auth struct {
Enable bool `mapstructure:"enable"`
User string `mapstructure:"username"`
Password string `mapstructure:"password"`

// ACM Endpoint
Endpoint string `mapstructure:"endpoint"`
// ACM RegionId
RegionId string `mapstructure:"regionId"`
// ACM AccessKey
AccessKey string `mapstructure:"accessKey"`
// ACM SecretKey
SecretKey string `mapstructure:"secretKey"`
// ACM OpenKMS
OpenKMS bool `mapstructure:"openKMS"`
}

0 comments on commit badd664

Please sign in to comment.