-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmain.go
executable file
·48 lines (40 loc) · 1.34 KB
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
package main
import (
"github.com/astaxie/beego"
"github.com/astaxie/beego/logs"
"github.com/astaxie/beego/plugins/cors"
migrationmanager "github.com/udistrital/plan_cuentas_mongo_crud/managers/migrationManager"
_ "github.com/udistrital/plan_cuentas_mongo_crud/routers"
apistatus "github.com/udistrital/utils_oas/apiStatusLib"
"github.com/udistrital/utils_oas/auditoria"
"github.com/udistrital/utils_oas/customerror"
)
func main() {
// beego.BConfig.RecoverFunc = responseformat.GlobalResponseHandler
if beego.BConfig.RunMode == "dev" {
beego.BConfig.WebConfig.DirectoryIndex = true
beego.BConfig.WebConfig.StaticDir["/swagger"] = "swagger"
}
beego.InsertFilter("*", beego.BeforeRouter, cors.Allow(&cors.Options{
AllowOrigins: []string{"*"},
AllowMethods: []string{"PUT", "PATCH", "GET", "POST", "OPTIONS", "DELETE"},
AllowHeaders: []string{"Origin", "x-requested-with",
"content-type",
"accept",
"origin",
"authorization",
"x-csrftoken"},
ExposeHeaders: []string{"Content-Length"},
AllowCredentials: true,
}))
if _, err := migrationmanager.RunMigrations(); err != nil {
logs.Error("Migrations Error: ", err.Error())
} else {
logs.Info("Migration process success !")
}
//Prueba de auditoria
auditoria.InitMiddleware()
beego.ErrorController(&customerror.CustomErrorController{})
apistatus.Init()
beego.Run()
}