Documentation ¶
Overview ¶
配置 直接从环境变量读取 `json:",env=SERVICE_NAME"` 或者配置yaml文件 ${SERVICE_NAME}
https://go-zero.dev/ https://github.com/zeromicro/zero-examples
go zero 目前支持k8s版本 k8s.io/api v0.26.3 k8s.io/apimachinery v0.27.0-alpha.3 k8s.io/client-go v0.26.3
Index ¶
Constants ¶
View Source
const ( DevMode = "dev" // 开发 TestMode = "test" // 测试 RtMode = "rt" // 回归测试 PreMode = "pre" // 预生产 ProMode = "pro" // 生产 )
运行环境
Variables ¶
View Source
var ( // 加载配置,失败则返回错误 Load = conf.Load )
Functions ¶
Types ¶
type Config ¶
type Config struct { zrpc.RpcServerConf MySQL struct { Host string Port int User string Pass string Database string } // zrpc.RpcServerConf.Redis字段必须设置Key // 所以另外定义字段,且字段名不能和Redis重名 RedisC struct { Addr string Pass string DB int } Bool bool }
Config rpc服务配置
type EtcdConf ¶
EtcdConf is the config item with the given key on etcd. Hosts etcd host array 127.0.0.1:2379 Key rpc registration key
type RpcClientConf ¶
type RpcClientConf = zrpc.RpcClientConf
RpcClientConf is a rpc client config. Etcd etcd related configuration Target rpc服务地址 localhost:9090
type RpcServerConf ¶
type RpcServerConf = zrpc.RpcServerConf
RpcServerConf is a rpc server config. ListenOn 监听地址 Etcd etcd related configuration Timeout 接口最大响应时间
type ServiceConf ¶
type ServiceConf = service.ServiceConf
ServiceConf is a service config. Name service name Mode 运行环境,默认为生产环境
Click to show internal directories.
Click to hide internal directories.