Plan stuff. Log stuff.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

28 lines
407 B

5 years ago
  1. package config
  2. import (
  3. "gopkg.in/yaml.v2"
  4. "os"
  5. )
  6. var root Config
  7. type Config struct {
  8. Database Database `yaml:"database"`
  9. Users Users `yaml:"users"`
  10. Server Server `yaml:"server"`
  11. }
  12. func Get() Config {
  13. return root
  14. }
  15. func Load(path string) (Config, error) {
  16. f, err := os.Open(path)
  17. if err != nil {
  18. return Config{}, err
  19. }
  20. err = yaml.NewDecoder(f).Decode(&root)
  21. return root, err
  22. }