README
¶
Configures
Configures for Golang
Features
- Open
- Multi environment support。
- Json
- Yaml
Install
go get github.com/aacfactory/configures
Usage
path, err := filepath.Abs("./_example/json")
if err != nil {
// handle error
return
}
store := configures.NewFileStore(path, "app", '.')
retriever, retrieverErr := configures.NewRetriever(configures.RetrieverOption{
Active: "dev",
Format: "JSON",
Store: store,
})
if retrieverErr != nil {
// handle error
return
}
config, configErr := retriever.Get()
if configErr != nil {
// handle error
return
}
Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config interface { Raw() []byte As(v interface{}) (err error) Get(path string, v interface{}) (has bool, err error) Node(path string) (v Config, has bool) }
func NewJsonConfig ¶
func NewYamlConfig ¶
type Retriever ¶
type Retriever struct {
// contains filtered or unexported fields
}
func NewRetriever ¶
func NewRetriever(option RetrieverOption) (retriever *Retriever, err error)
type RetrieverOption ¶
Click to show internal directories.
Click to hide internal directories.