Moved stuff to main instead of init

This commit is contained in:
Travis
2013-01-15 23:56:47 -08:00
parent 529c83acba
commit 5c2f8a9909

View File

@@ -42,6 +42,25 @@ var config struct {
var icache = cache.New("routing-table")
func init() {
}
type Route struct {
// TODO: Change destinations to a simple cache so it can expire entries after 55 minutes (the one we use in common?)
Host string `json:"host"`
Destinations []string `json:"destinations"`
ProjectId string `json:"project_id"`
Token string `json:"token"` // store this so we can queue up new workers on demand
CodeName string `json:"code_name"`
}
// for adding new hosts
type Route2 struct {
Host string `json:"host"`
Dest string `json:"dest"`
}
func main() {
runtime.GOMAXPROCS(runtime.NumCPU())
log.Println("Running on", runtime.NumCPU(), "CPUs")
@@ -62,25 +81,6 @@ func init() {
common.SetLogLocation(config.Logging.To, config.Logging.Prefix)
icache.Settings.UseConfigMap(map[string]interface{}{"token": config.Iron.Token, "project_id": config.Iron.ProjectId})
}
type Route struct {
// TODO: Change destinations to a simple cache so it can expire entries after 55 minutes (the one we use in common?)
Host string `json:"host"`
Destinations []string `json:"destinations"`
ProjectId string `json:"project_id"`
Token string `json:"token"` // store this so we can queue up new workers on demand
CodeName string `json:"code_name"`
}
// for adding new hosts
type Route2 struct {
Host string `json:"host"`
Dest string `json:"dest"`
}
func main() {
r := mux.NewRouter()
s := r.Headers("Iron-Router", "").Subrouter()