- Support Types
- YAML
- JSON
- TOML
- INI
- DotEnv
- ENV
- Support Object Storage
- S3
- ALI OSS
- Tencent COS
- Support Database
- Redis
- MongoDB
- Etcd
- Support Configuration Center
- Apollo
- Nacos
To install the package, run:
go get github.com/go-zoox/config
type Config struct {
Version string `config:"version"`
Server struct {
Ports []int64 `config:"ports"`
Cleanup string `config:"cleanup"`
} `config:"server"`
Logger struct {
Level string `config:"level"`
Trace bool `config:"trace"`
} `config:"logger"`
Rules []struct {
Host string `config:"host"`
Backend struct {
ServiceName string `config:"service_name"`
ServicePort int64 `config:"service_port"`
} `config:"backend"`
} `config:"rules"`
}
func main() {
var cfg Config
if err := Load(&cfg); err != nil {
panic(err)
}
}
GoZoox is released under the MIT License.