func main() {
	tracelog.Start(tracelog.LevelInfo)

	RunServer()

	tracelog.Stop()
}
Example #2
0
func main() {
	tracelog.Start(tracelog.LevelTrace)

	// Init mongo
	tracelog.Started("main", "Initializing Mongo")
	err := mongo.Startup(helper.MainGoRoutine)
	if err != nil {
		tracelog.CompletedError(err, helper.MainGoRoutine, "initApp")
		os.Exit(1)
	}

	// Load message strings
	localize.Init("en-US")

	SessionConfig, err := session.GetSessionConfig("session")

	tracelog.Trace("main", "SessionConfig", "Session : On[%v]", SessionConfig.On)
	tracelog.Trace("main", "SessionConfig", "Session : On[%v]", SessionConfig.Provider)
	tracelog.Trace("main", "SessionConfig", "Session : On[%v]", SessionConfig.SavePath)

	beego.SessionOn = SessionConfig.On
	beego.SessionProvider = SessionConfig.Provider
	beego.SessionSavePath = SessionConfig.SavePath

	beego.Run()

	tracelog.Completed(helper.MainGoRoutine, "Website Shutdown")
	tracelog.Stop()
}
Example #3
0
// init initializes all required packages and systems
func init() {
	tracelog.Start(tracelog.LEVEL_TRACE)

	// Init mongo
	tracelog.STARTED("main", "Initializing Mongo")
	err := mongo.Startup(helper.MAIN_GO_ROUTINE)
	if err != nil {
		tracelog.COMPLETED_ERROR(err, helper.MAIN_GO_ROUTINE, "initTesting")
		return
	}
}
Example #4
0
// init initializes all required packages and systems
func init() {
	log.Start(log.LevelTrace)

	// Init mongo
	log.Started("main", "Initializing Mongo")
	err := mongo.Startup(helper.MainGoRoutine)
	if err != nil {
		log.CompletedError(err, helper.MainGoRoutine, "initTesting")
		return
	}

	// Load message strings
	localize.Init("en-US")
}
Example #5
0
func main() {

	tracelog.Start(tracelog.LevelTrace)
	err := mongo.Startup(helper.MainGoRoutine)
	if err != nil {
		tracelog.CompletedError(err, helper.MainGoRoutine, "initApp")
		os.Exit(1)
	} else {
		fmt.Println("mongodb启动正常")
	}
	beego.Run()

	tracelog.Completed(helper.MainGoRoutine, "Website Shutdown")
	tracelog.Stop()
}
Example #6
0
func main() {
	tracelog.Start(tracelog.LEVEL_TRACE)

	// Init mongo
	tracelog.STARTED("main", "Initializing Mongo")
	err := mongo.Startup(helper.MAIN_GO_ROUTINE)
	if err != nil {
		tracelog.COMPLETED_ERROR(err, helper.MAIN_GO_ROUTINE, "initApp")
		os.Exit(1)
	}

	beego.Run()

	tracelog.STARTED(helper.MAIN_GO_ROUTINE, "Website Shutdown")
	tracelog.Stop()
}
Example #7
0
func main() {
	tracelog.Start(tracelog.LEVEL_TRACE)

	// Init mongo
	tracelog.Started("main", "Initializing Mongo")
	err := mongo.Startup(helper.MAIN_GO_ROUTINE)
	if err != nil {
		tracelog.CompletedError(err, helper.MAIN_GO_ROUTINE, "initApp")
		os.Exit(1)
	}

	// Load message strings
	localize.Init("en-US")

	beego.Run()

	tracelog.Completed(helper.MAIN_GO_ROUTINE, "Website Shutdown")
	tracelog.Stop()
}
func main() {
	tracelog.Start(tracelog.LevelTrace)
	//tracelog.Start(tracelog.LevelInfo)

	var port = os.Getenv("PORT")

	if port == "" {
		tracelog.Error(nil, "The PORT environment variable has not been set.", "main")
		os.Exit(1)
	}

	var myGasFeedBaseUrl = os.Getenv("MY_GAS_FEED_BASE_URL")
	if myGasFeedBaseUrl == "" {
		tracelog.Error(nil, "The MY_GAS_FEED_BASE_URL environment variable has not been set.", "main")
	}
	SetMyGasFeedBaseUrl(myGasFeedBaseUrl)

	var myGasFeedApiKey = os.Getenv("MY_GAS_FEED_API_KEY")
	if myGasFeedApiKey == "" {
		tracelog.Error(nil, "The MY_GAS_FEED_API_KEY environment variable has not been set.", "main")
	}
	SetMyGasFeedApiKey(myGasFeedApiKey)

	tracelog.Info("Started", "main", "Gas Price Service is starting and listening on port %s", port)

	router := mux.NewRouter()
	for _, route := range routes {
		var handler http.Handler

		handler = route.HandlerFunc
		handler = Logger(handler, route.Name)

		router.Methods(route.Method).Path(route.Pattern).Name(route.Name).Handler(handler)
	}

	err := http.ListenAndServe(":"+port, router)
	if err != nil {
		tracelog.Error(err, "An error occurred while attempting to listen and serve", "main")
	}

	tracelog.Info("Stopped", "main", "Gas Price Service has been terminated")
	tracelog.Stop()
}
Example #9
0
func main() {
	tracelog.Start(tracelog.LevelTrace)

	// Init mongo
	tracelog.Started("main", "Initializing Mongo")
	err := mongo.Startup(helper.MainGoRoutine)
	if err != nil {
		tracelog.CompletedError(err, helper.MainGoRoutine, "initApp")
		os.Exit(1)
	}

	// Load message strings
	localize.Init("en-US")

	beego.Run()

	tracelog.Completed(helper.MainGoRoutine, "Website Shutdown")
	tracelog.Stop()
}
Example #10
0
func main() {
	tracelog.Start(tracelog.LevelTrace)

	// Init mongo
	tracelog.Started("main", "Initializing Mongo")
	err := mongo.Startup(helper.MainGoRoutine)
	if err != nil {
		tracelog.CompletedError(err, helper.MainGoRoutine, "initApp")
		os.Exit(1)
	}

	// Load message strings
	localize.Init("en-US")
	beego.BConfig.WebConfig.Session.SessionOn = true
	globalSessions, _ = session.NewManager("redis", `{"cookieName":"gosessionid","gclifetime":3600,"ProviderConfig":"127.0.0.1:6379"}`)
	go globalSessions.GC()
	beego.Run()

	tracelog.Completed(helper.MainGoRoutine, "Website Shutdown")
	tracelog.Stop()
}
func main() {
	// tracelog.Start(tracelog.LevelTrace)
	tracelog.Start(tracelog.LevelInfo)

	var port = os.Getenv("PORT")
	if port == "" {
		tracelog.Error(nil, "The PORT environment variable has not been set.", "main")
		os.Exit(1)
	}

	var mapsApiKey = os.Getenv("GOOGLE_MAPS_API_KEY")
	if mapsApiKey == "" {
		tracelog.Error(nil, "The GOOGLE_MAPS_API_KEY enviornment variable has not been set.", "main")
		os.Exit(2)
	}
	SetGoogleAPIKey(mapsApiKey)

	tracelog.Info("Started", "main", "Google Reverse Geocode Service is starting and listening on port %s", port)

	router := mux.NewRouter()
	for _, route := range routes {
		var handler http.Handler

		handler = route.HandlerFunc
		handler = Logger(handler, route.Name)

		router.Methods(route.Method).Path(route.Pattern).Name(route.Name).Handler(handler)
	}

	err := http.ListenAndServe(":"+port, router)
	if err != nil {
		tracelog.Error(err, "An error occurred while attempting to listen and serve.", "main")
		os.Exit(3)
	}

	tracelog.Info("Stopped", "main", "Google Reverse Geocode Service has been terminated")
	tracelog.Stop()
}