-
Notifications
You must be signed in to change notification settings - Fork 49
/
main.go
34 lines (30 loc) · 916 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
package main
import (
"flag"
"log"
"github.com/pyroscope-io/pyroscope/pkg/agent/profiler"
"github.com/sujit-baniya/fiber-boilerplate/app"
"github.com/sujit-baniya/fiber-boilerplate/migrations"
"github.com/sujit-baniya/fiber-boilerplate/rest/routes"
)
func main() {
configFile := flag.String("config", "config.yml", "User Config file from user")
migrate := flag.Bool("migrate", false, "Update db structure")
flag.Parse()
app.Load(*configFile)
if app.Http.Profiler.Enabled {
_, _ = profiler.Start(profiler.Config{
ApplicationName: app.Http.Server.Name,
ServerAddress: app.Http.Profiler.Server,
})
}
app.Http.Server.Version = app.Version
if *migrate {
migrations.Migrate()
} else {
// app.LoadAdditionalServices() // Enable for PayPal and any other services
routes.LoadRoutes(app.Http.Server.App)
app.Http.Route404()
log.Fatal(app.Http.Server.ServeWithGraceFullShutdown())
}
}