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.
55 lines
713 B
55 lines
713 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("etc/config.toml", 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 { |
|
Addr string |
|
} |
|
|
|
type Sqlite struct { |
|
DbPath string |
|
} |
|
|
|
type Game struct { |
|
GiftChip int32 |
|
}
|
|
|