# README
Config - A minimalist Go configuration library
Features
- 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
Installation
To install the package, run:
go get github.com/go-zoox/config
Getting Started
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)
}
}
License
GoZoox is released under the MIT License.
# Functions
Async loads the config from the given service.
IsNotFoundErr returns true if the error is a not found error.
Load loads the config from the given file path.
LoadFromService loads the config from the given service.
Parse parses the config from the given raw config.
# Constants
DefaultFileType is the default file type.
# Variables
Version is the version of this package.