-
Notifications
You must be signed in to change notification settings - Fork 2
/
main.go
41 lines (36 loc) · 937 Bytes
/
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
package main
import (
"fmt"
"os"
"strconv"
"time"
"github.com/astaxie/beego"
"github.com/astaxie/beego/logs"
"github.com/astaxie/beego/plugins/cors"
_ "github.com/gnosis/pm-kyc-service/models"
_ "github.com/gnosis/pm-kyc-service/routers"
)
func main() {
log := logs.NewLogger(10000)
log.SetLogger("console")
onlyCompile, _ := strconv.ParseBool(os.Getenv("ONLY_COMPILE"))
fmt.Println("Configure Cors")
beego.InsertFilter("*", beego.BeforeRouter, cors.Allow(&cors.Options{
// AllowOrigins: []string{"*"},
AllowAllOrigins: true,
AllowMethods: []string{"POST", "PUT", "PATCH"},
AllowHeaders: []string{"Origin"},
ExposeHeaders: []string{"Content-Length"},
AllowCredentials: true,
}))
fmt.Println("Start running")
if onlyCompile {
beego.BConfig.RunMode = beego.DEV
go beego.Run()
time.Sleep(5000 * time.Millisecond)
log.Warn("Exiting program")
os.Exit(0)
} else {
beego.Run()
}
}