33 lines
634 B
Go
33 lines
634 B
Go
package main
|
|
|
|
import (
|
|
"io/ioutil"
|
|
"log"
|
|
|
|
"gopkg.in/yaml.v2"
|
|
)
|
|
|
|
// Config of pure-ftp-auth
|
|
type Config struct {
|
|
Path string `yaml:"path"`
|
|
Userid string `yaml:"uid"`
|
|
Groupid string `yaml:"gid"`
|
|
Quote string `yaml:"quote"`
|
|
Database string `yaml:"database"`
|
|
Log struct {
|
|
Path string `yaml:"path"`
|
|
} `yaml:"log"`
|
|
DatabaseDebug bool `yaml:"databasedebug"`
|
|
}
|
|
|
|
// 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
|
|
}
|