Skip to content
/ config Public

A minimalist Go configuration library, support YAML、JSON、TOML、INI、DotEnv、Shell Environment

License

Notifications You must be signed in to change notification settings

go-zoox/config

Repository files navigation

Config - A minimalist Go configuration library

PkgGoDev Build Status Go Report Card Coverage Status GitHub issues Release

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.

About

A minimalist Go configuration library, support YAML、JSON、TOML、INI、DotEnv、Shell Environment

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages