Add initial code

This commit is contained in:
Jacob Gunther
2022-07-30 22:13:16 -05:00
commit 70601daac0
14 changed files with 1213 additions and 0 deletions

28
src/config.go Normal file
View File

@@ -0,0 +1,28 @@
package main
import (
"io/ioutil"
"time"
"github.com/go-yaml/yaml"
)
type Configuration struct {
Environment string `yaml:"environment"`
Host string `yaml:"host"`
Port uint16 `yaml:"port"`
Redis string `yaml:"redis"`
CacheEnable bool `yaml:"cache_enable"`
StatusCacheTTL time.Duration `yaml:"status_cache_ttl"`
FaviconCacheTTL time.Duration `yaml:"favicon_cache_ttl"`
}
func (c *Configuration) ReadFile(path string) error {
data, err := ioutil.ReadFile(path)
if err != nil {
return err
}
return yaml.Unmarshal(data, c)
}