-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
42 lines (34 loc) · 811 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
42
package main
import (
"log"
"os"
"github.com/kybton/go-gin-clean-architecture/configs"
"github.com/kybton/go-gin-clean-architecture/src/app"
"github.com/kybton/go-gin-clean-architecture/src/infra"
"github.com/kybton/go-gin-clean-architecture/src/initializers"
"go.uber.org/dig"
)
var diContainer *dig.Container
func init() {
// Loading configs on the application starts up
var err error
diContainer, err = infra.DependencyInjector()
if err != nil {
log.Fatal(err)
os.Exit(1)
}
if err = diContainer.Invoke(configs.LoadConfigs); err != nil {
log.Fatal(err)
os.Exit(2)
}
if err = diContainer.Invoke(initializers.InitDatabase); err != nil {
log.Fatal(err)
os.Exit(3)
}
}
func main() {
if err := diContainer.Invoke(app.NewServer); err != nil {
log.Fatal(err)
os.Exit(3)
}
}