18 lines
452 B
Go
18 lines
452 B
Go
|
|
package config
|
||
|
|
|
||
|
|
import "fmt"
|
||
|
|
|
||
|
|
// GRPCConfig gRPC 服务器配置
|
||
|
|
type GRPCConfig struct {
|
||
|
|
Enabled bool `mapstructure:"enabled"`
|
||
|
|
Port int `mapstructure:"port"`
|
||
|
|
TLSEnabled bool `mapstructure:"tls_enabled"`
|
||
|
|
TLSCertFile string `mapstructure:"tls_cert_file"`
|
||
|
|
TLSKeyFile string `mapstructure:"tls_key_file"`
|
||
|
|
}
|
||
|
|
|
||
|
|
// Address 返回 gRPC 服务器监听地址
|
||
|
|
func (c *GRPCConfig) Address() string {
|
||
|
|
return fmt.Sprintf(":%d", c.Port)
|
||
|
|
}
|