Add initial code

This commit is contained in:
Jacob Gunther
2022-03-08 21:28:46 -06:00
commit b0518288da
33 changed files with 2175 additions and 0 deletions

26
src/config.go Normal file
View File

@@ -0,0 +1,26 @@
package main
import (
"io/ioutil"
"gopkg.in/yaml.v2"
)
type Configuration struct {
Host string `yaml:"host"`
Port uint16 `yaml:"port"`
Redis struct {
URI string `yaml:"uri"`
Database int `yaml:"database"`
} `yaml:"redis"`
}
func (c *Configuration) ReadFile(file string) error {
data, err := ioutil.ReadFile(file)
if err != nil {
return err
}
return yaml.Unmarshal(data, c)
}