package config import ( "fmt" "local/args" "os" "strings" ) var ( Port string StoreType string StoreAddr string StoreUser string StorePass string Public string ) func init() { Refresh() } func Refresh() { if strings.Contains(fmt.Sprint(os.Args), "-test") { return } as := args.NewArgSet() as.Append(args.STRING, "port", "port to listen on", "39909") as.Append(args.STRING, "store", "type of store", "map") as.Append(args.STRING, "storeaddr", "addr of store", "") as.Append(args.STRING, "storeuser", "user of store", "") as.Append(args.STRING, "storepass", "pass of store", "") as.Append(args.STRING, "public", "url of php server", "http://localhost:38808") if err := as.Parse(); err != nil { panic(err) } Port = ":" + strings.TrimPrefix(as.Get("port").GetString(), ":") StoreType = as.Get("store").GetString() StoreAddr = as.Get("storeaddr").GetString() StoreUser = as.Get("storeuser").GetString() StorePass = as.Get("storepass").GetString() Public = as.Get("public").GetString() }