Documentation
¶
Index ¶
- Variables
- func AsciiLogo(serverName ...string)
- type AppConfig
- type Aqi
- type Option
- func ConfigFile(file string) Option
- func DataPath(path string) Option
- func Guard(fn ws.GuardFunc) Option
- func HttpServer(name, portFindPath string) Option
- func Language(lng string) Option
- func LogConfig(configKeyPath string) Option
- func Server(name ...string) Option
- func WatchHandler(handler func()) Option
- type Provider
- type RemoteProvider
Constants ¶
This section is empty.
Variables ¶
View Source
var ( Branch string Revision string BuildDate string CommitVersion string )
Functions ¶
Types ¶
type AppConfig ¶
type AppConfig struct {
//运行时数据存储基础路径
DataPath string
//应用日志文件配置路径
LogPathKey string
//默认语言
Language string
//服务名称,support.Version
//当指定 HttpServerPortFindPath 时,在配置读取之后从配置路径获取http端口
Servername []string
ServerPort string
HttpServerPortFindPath string
ConfigType string //配置文件类型
ConfigPath string //配置文件路径
ConfigName string //配置文件名称
Configs map[string]any
Guard ws.GuardFunc //守护回调
HttpServer http.Handler //http server
RemoteProvider *RemoteProvider //远程配置支持etcd, consul
WatchHandler func()
// contains filtered or unexported fields
}
func (*AppConfig) GetDataPath ¶
func (*AppConfig) WithHttpServer ¶
func (*AppConfig) WriteDefaultConfig ¶
type Option ¶
func ConfigFile ¶
func HttpServer ¶
func WatchHandler ¶
func WatchHandler(handler func()) Option
type Provider ¶
type Provider string
const ProviderConsul Provider = "consul"
const ProviderEtcd Provider = "etcd"
type RemoteProvider ¶
type RemoteProvider struct {
Name Provider //服务商名称
Path string //路径
Endpoint string //服务器地址
Type string //json, yaml等
}
func ParseRemoteProvider ¶
func ParseRemoteProvider(s string) *RemoteProvider
ParseRemoteProvider 格式 provider[s]://endpoint/path.type 例:consul://localhost:8500/a.yaml 表示远程配置中心为consul,服务器地址为http://localhost:8500, path为a, 配置类型是yaml scheme加s表示服务器支持ssl
Source Files
¶
Click to show internal directories.
Click to hide internal directories.
