Allow more customizability with config
This commit is contained in:
@@ -1,24 +0,0 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"io/ioutil"
|
||||
|
||||
"gopkg.in/yaml.v2"
|
||||
)
|
||||
|
||||
type Configuration struct {
|
||||
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)
|
||||
}
|
||||
Reference in New Issue
Block a user