Documentation
¶
Index ¶
- Variables
- func GetServiceAddress() string
- func GetServiceID() string
- func GetServiceName() string
- func LoadConfig() error
- func LoadConfigFromConsul(key string) error
- type ConsulConfig
- type DatabaseConfig
- type JWTConfig
- type KafkaConfig
- type RedisConfig
- type RocketMQConfig
- type SMSConfig
- type ServerConfig
- type ServiceConfig
Constants ¶
This section is empty.
Variables ¶
View Source
var Config *config
Functions ¶
func GetServiceAddress ¶
func GetServiceAddress() string
func GetServiceID ¶
func GetServiceID() string
func GetServiceName ¶
func GetServiceName() string
func LoadConfig ¶
func LoadConfig() error
Types ¶
type ConsulConfig ¶
type ConsulConfig struct {
Address string `yaml:"address" json:"address"`
Token string `yaml:"token" json:"token"` // 可选,ACL Token
}
新增 Consul 配置结构体
type DatabaseConfig ¶
type DatabaseConfig struct {
Dialect string `yaml:"dialect" json:"dialect"`
Host string `yaml:"host" json:"host"`
Port int `yaml:"port" json:"port"`
Database string `yaml:"database" json:"database"`
User string `yaml:"user" json:"user"`
Password string `yaml:"password" json:"password"`
Schema string `yaml:"schema" json:"schema"`
Level string `yaml:"level" json:"level"`
}
type KafkaConfig ¶
type RedisConfig ¶
type RocketMQConfig ¶
type RocketMQConfig struct {
NameServer string `yaml:"nameServer" json:"nameServer"` // RocketMQ NameServer 地址
GroupName string `yaml:"groupName" json:"groupName"` // Producer 分组
ProducerTopic string `yaml:"producerTopic" json:"producerTopic"` // Producer 使用的 topic
ConsumerTopic string `yaml:"consumerTopic" json:"consumerTopic"` // Consumer 订阅的 topic
RetryTimes int `yaml:"retryTimes" json:"retryTimes"` // 发送失败重试次数
}
type SMSConfig ¶
type SMSConfig struct {
Provider string `yaml:"provider" json:"provider"`
AccessKeyID string `yaml:"accessKeyId" json:"accessKeyId"`
AccessKeySecret string `yaml:"accessKeySecret" json:"accessKeySecret"`
SignName string `yaml:"signName" json:"signName"`
TemplateCode string `yaml:"templateCode" json:"templateCode"`
Region string `yaml:"region" json:"region"`
CodeExpireSeconds int `yaml:"codeExpireSeconds" json:"codeExpireSeconds"`
}
type ServerConfig ¶
type ServerConfig struct {
User ServiceConfig `yaml:"user" json:"user"`
Order ServiceConfig `yaml:"order" json:"order"`
Gateway ServiceConfig `yaml:"gateway" json:"gateway"` // 新增 Gateway 服务配置
}
Click to show internal directories.
Click to hide internal directories.