You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

registry_config.go 1.4 kB

3 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142
  1. package config
  2. import (
  3. "time"
  4. )
  5. var config *RegistryConfig
  6. // RegistryConfig registry config
  7. type RegistryConfig struct {
  8. Mode string `yaml:"type" json:"type,omitempty"` //类型
  9. NacosConfig NacosConfig `yaml:"nacos" json:"nacos,omitempty"`
  10. EtcdConfig EtcdConfig `yaml:"etcdv3" json:"etcdv3"`
  11. }
  12. // NacosConfig nacos config
  13. type NacosConfig struct {
  14. Application string `yaml:"application" json:"application,omitempty"`
  15. ServerAddr string `yaml:"server_addr" json:"server_addr,omitempty"`
  16. Group string `default:"SEATA_GROUP" yaml:"group" json:"group,omitempty"`
  17. Namespace string `yaml:"namespace" json:"namespace,omitempty"`
  18. Cluster string `yaml:"cluster" json:"cluster,omitempty"`
  19. UserName string `yaml:"username" json:"username,omitempty"`
  20. Password string `yaml:"password" json:"password,omitempty"`
  21. }
  22. // InitRegistryConfig init registry config
  23. func InitRegistryConfig(registryConfig *RegistryConfig) {
  24. config = registryConfig
  25. }
  26. // GetRegistryConfig get registry config
  27. func GetRegistryConfig() *RegistryConfig {
  28. return config
  29. }
  30. type EtcdConfig struct {
  31. ClusterName string `default:"seata-golang-etcdv3" yaml:"cluster_name" json:"cluster_name,omitempty"`
  32. Endpoints string `yaml:"endpoints" json:"endpoints,omitempty"`
  33. Heartbeats int `yaml:"heartbeats" json:"heartbeats"`
  34. Timeout time.Duration `yaml:"timeout" json:"timeout"`
  35. }

Go Implementation For Seata