good morning!!!!

Skip to content
Snippets Groups Projects
Commit 911d54f0 authored by a's avatar a
Browse files

better example

parent e7d586b3
No related branches found
No related tags found
No related merge requests found
......@@ -2,8 +2,6 @@
gun, short for go config, is a very opinionated and simple config library
it's meant to be incredibly simple.
## how to use
simply create a struct that is json encodable into what you need
......@@ -17,7 +15,12 @@ does NOT work with nested variables.
env vars ONLY works with integer types, float types, and string. all other types will PANIC!!!
what you can do is this
```
package main
var Config struct {
Field string `yaml:"some_field"`
Crack int
......@@ -33,6 +36,10 @@ var Config struct {
func init() {
gun.Load(&Config)
}
func main() {
_ = Config.Field
}
```
It will look for the config file in the following places.
......@@ -46,8 +53,6 @@ It will look for the config file in the following places.
6. /config.json
## important
gun will read config file only once, when you ask it to read.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment