You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

56 lines
714 B

package conf
import (
"flag"
"github.com/BurntSushi/toml"
)
var (
confPath string
Conf *Config
)
func init() {
// go run xx -conf=xx.toml
flag.StringVar(&confPath, "conf", "etc/config.toml", "default config path.")
Conf = Default()
_, err := toml.DecodeFile(confPath, Conf)
if err != nil {
panic(err)
}
// fmt.Printf("%v", Conf)
}
func Default() *Config {
return &Config{
Auth: &Auth{
IgnoreUrl: []string{},
},
}
}
type Config struct {
Auth *Auth
Http *Http
Sqlite *Sqlite
Game *Game
}
type Auth struct {
AesTokenKey string
IgnoreUrl []string
}
type Http struct {
Host string
Port int
}
type Sqlite struct {
DbPath string
}
type Game struct {
GiftChip int32
}