Files
stufflog/config/config.go
T
2020-02-04 18:46:10 +01:00

29 lines
407 B
Go

package config
import (
"gopkg.in/yaml.v2"
"os"
)
var root Config
type Config struct {
Database Database `yaml:"database"`
Users Users `yaml:"users"`
Server Server `yaml:"server"`
}
func Get() Config {
return root
}
func Load(path string) (Config, error) {
f, err := os.Open(path)
if err != nil {
return Config{}, err
}
err = yaml.NewDecoder(f).Decode(&root)
return root, err
}