25 lines
410 B
Go
25 lines
410 B
Go
|
package main
|
||
|
|
||
|
import (
|
||
|
"io/ioutil"
|
||
|
"log"
|
||
|
|
||
|
"gopkg.in/yaml.v2"
|
||
|
)
|
||
|
|
||
|
// Config of warehost webserver
|
||
|
type Config struct {
|
||
|
Database string `yaml:"database"`
|
||
|
}
|
||
|
|
||
|
// ReadConfigFile reads a config models by path to a yml file
|
||
|
func ReadConfigFile(path string) *Config {
|
||
|
config := &Config{}
|
||
|
file, _ := ioutil.ReadFile(path)
|
||
|
err := yaml.Unmarshal(file, &config)
|
||
|
if err != nil {
|
||
|
log.Fatal(err)
|
||
|
}
|
||
|
return config
|
||
|
}
|