burlesque/config.go

30 lines
679 B
Go
Raw Normal View History

2014-07-10 19:19:39 +07:00
package main
import (
"flag"
)
const (
2014-07-17 01:57:54 +07:00
// With compression: burlesque.kch#opts=c#zcomp=gz#msiz=524288000
2014-07-17 20:22:37 +07:00
DefaultProductionStorage = "burlesque.kch#dfunit=8#msiz=512M"
)
2014-07-16 02:46:22 +07:00
var (
2014-07-10 19:19:39 +07:00
Config struct {
Storage string
Env string
Port int
}
)
func SetupConfig() {
2014-07-17 00:42:21 +07:00
flag.StringVar(&Config.Storage, "storage", "-", "Kyoto Cabinet storage path (e.g. "+DefaultProductionStorage+")")
2014-07-29 13:26:00 +07:00
flag.StringVar(&Config.Env, "environment", "production", "Process environment: production or development")
2014-07-17 00:42:21 +07:00
flag.IntVar(&Config.Port, "port", 4401, "Server HTTP port")
2014-07-10 19:19:39 +07:00
flag.Parse()
2014-07-16 02:46:22 +07:00
if Config.Env == "production" && Config.Storage == "-" {
Config.Storage = DefaultProductionStorage
}
2014-07-10 19:19:39 +07:00
}