diff --git a/example_config.yaml b/example_config.yaml index 3de4f29..10d0567 100644 --- a/example_config.yaml +++ b/example_config.yaml @@ -18,3 +18,8 @@ yoyogo: enable: true username: "root" password: "1234" + endpoint: "" + regionId: "" + accessKey: "" + secretKey: "" + openKMS: false diff --git a/nacos_manager.go b/nacos_manager.go index e30d566..2df06b9 100644 --- a/nacos_manager.go +++ b/nacos_manager.go @@ -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, diff --git a/nacos_options.go b/nacos_options.go index cba5200..5b2e325 100644 --- a/nacos_options.go +++ b/nacos_options.go @@ -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"` }