2020-02-13 07:27:07 +03:00
|
|
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
|
|
// Licensed under the MIT license.
|
|
|
|
|
2019-11-04 08:47:22 +03:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"os"
|
|
|
|
|
|
|
|
"github.com/astaxie/beego"
|
|
|
|
"github.com/astaxie/beego/plugins/cors"
|
2020-02-05 18:51:12 +03:00
|
|
|
"github.com/microsoft/mouselog/routers"
|
2019-11-04 08:47:22 +03:00
|
|
|
|
2019-12-10 15:47:27 +03:00
|
|
|
_ "github.com/microsoft/mouselog/routers"
|
2020-01-15 10:40:58 +03:00
|
|
|
"github.com/microsoft/mouselog/trace"
|
2019-11-04 08:47:22 +03:00
|
|
|
)
|
|
|
|
|
|
|
|
func main() {
|
2020-01-15 10:40:58 +03:00
|
|
|
trace.InitOrmManager()
|
2020-02-29 22:25:30 +03:00
|
|
|
trace.InitMapMutexes()
|
2020-01-15 10:40:58 +03:00
|
|
|
|
2019-11-04 08:47:22 +03:00
|
|
|
beego.InsertFilter("*", beego.BeforeRouter, cors.Allow(&cors.Options{
|
|
|
|
AllowOrigins: []string{"*"},
|
|
|
|
AllowMethods: []string{"GET", "PUT", "PATCH"},
|
|
|
|
AllowHeaders: []string{"Origin"},
|
|
|
|
ExposeHeaders: []string{"Content-Length"},
|
|
|
|
AllowCredentials: true,
|
|
|
|
}))
|
|
|
|
|
2020-02-05 18:51:12 +03:00
|
|
|
//beego.DelStaticPath("/static")
|
|
|
|
beego.SetStaticPath("/static", "web/build/static")
|
2020-02-15 05:32:17 +03:00
|
|
|
|
|
|
|
beego.SetStaticPath("/screenshots", "static/screenshots")
|
|
|
|
|
2020-02-05 18:51:12 +03:00
|
|
|
// https://studygolang.com/articles/2303
|
|
|
|
beego.InsertFilter("/", beego.BeforeRouter, routers.TransparentStatic) // must has this for default page
|
|
|
|
beego.InsertFilter("/*", beego.BeforeRouter, routers.TransparentStatic)
|
|
|
|
|
2020-02-29 22:25:30 +03:00
|
|
|
beego.BConfig.WebConfig.Session.SessionProvider = "file"
|
2019-11-04 08:47:22 +03:00
|
|
|
beego.BConfig.WebConfig.Session.SessionProviderConfig = "./tmp"
|
|
|
|
beego.BConfig.WebConfig.Session.SessionGCMaxLifetime = 3600 * 24 * 365
|
|
|
|
|
2020-02-08 13:44:15 +03:00
|
|
|
port := beego.AppConfig.String("httpport")
|
2019-11-04 08:47:22 +03:00
|
|
|
if len(os.Args) > 1 {
|
|
|
|
port = os.Args[1]
|
|
|
|
}
|
|
|
|
|
|
|
|
beego.Run("0.0.0.0:" + port)
|
|
|
|
}
|