package config import ( "fmt" "github.com/BurntSushi/toml" "os" ) var ( // Conf crocodile conf Conf *conf ) // Init Config func Init(conf string) { _, err := toml.DecodeFile(conf, &Conf) if err != nil { fmt.Printf("Err %v", err) os.Exit(1) } } type conf struct { Serve serve DB db Nsq nsq UdpNode []node Mail mail Log log } type serve struct { Udp string LoadStart int64 Thread int SiteColl string ValidDays int StatusDays int BackupFlag bool } type node struct { Addr string Port int Memo string } type mail struct { Send bool To string Api string } // Log Config type log struct { LogPath string MaxSize int Compress bool MaxAge int MaxBackups int LogLevel string Format string } type db struct { MongoP mgo MongoB mgo MongoS mgo Es es Redis redis } type mgo struct { Addr string Dbname string Coll string Size int User string Password string } type nsq struct { Addr string Topic string Channel string Concurrent int } type redis struct { Addr string AddrQb string DbQb int } type es struct { Addr string Size int Index string User string Password string }