First commit

This commit is contained in:
2020-02-04 18:46:10 +01:00
commit 190e1eb01d
91 changed files with 13411 additions and 0 deletions
+28
View File
@@ -0,0 +1,28 @@
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
}
+6
View File
@@ -0,0 +1,6 @@
package config
type Database struct {
Driver string `yaml:"driver"`
Path string `yaml:"path"`
}
+6
View File
@@ -0,0 +1,6 @@
package config
type Server struct {
Listen string
Debug bool
}
+5
View File
@@ -0,0 +1,5 @@
package config
type Users struct {
AllowRegister bool `yaml:"allow_register"`
}