package main import ( "io/ioutil" "gopkg.in/yaml.v2" ) // Config of warehost webserver type Config struct { WarehostDatabase string `yaml:"warehostdatabase"` Log struct { Path string `yaml:"path"` } `yaml:"log"` DatabaseDebug bool `yaml:"databasedebug"` PathUser string `yaml:"path_user"` PathGroup string `yaml:"path_group"` Web struct { Enable bool `yaml:"enable"` ConfigurationTemplate string `yaml:"template"` ConfigurationFile string `yaml:"config"` PathDomain string `yaml:"path_domain"` } `yaml:"web"` WebModul struct { Enable bool `yaml:"enable"` PathID string `yaml:"path_id"` } `yaml:"web_modul"` FTP struct { Enable bool `yaml:"enable"` PathID string `yaml:"path_id"` } `yaml:"ftp"` Database struct { Enable bool `yaml:"enable"` Type string `yaml:"type"` Connection string `yaml:"connection"` Prefix string `yaml:"prefix"` } `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 { panic(err) } return config }