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