-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.go
More file actions
47 lines (40 loc) · 935 Bytes
/
main.go
File metadata and controls
47 lines (40 loc) · 935 Bytes
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
package main
import (
"authservice/cmd"
"authservice/service/oauth"
"log"
"os"
"os/signal"
"path/filepath"
"github.com/Smart-Pot/pkg"
"github.com/Smart-Pot/pkg/adapter/amqp"
"github.com/Smart-Pot/pkg/db"
)
func main() {
if err := pkg.Config.ReadConfig(); err != nil {
log.Fatal(err)
}
log.Println("Configurations are set")
if err := db.Connect(db.PkgConfig("users")); err != nil {
log.Fatal(err)
}
log.Println("DB Connection established")
if err := amqp.Set(pkg.Config.AMQPAddress); err != nil {
log.Fatal(err)
}
log.Println("AMQP module is set")
wd, _ := os.Getwd()
if err := oauth.ReadConfig(filepath.Join(wd, "config")); err != nil {
log.Fatal(err)
}
log.Println("OAuth module is set")
c := make(chan os.Signal, 1)
signal.Notify(c, os.Interrupt, os.Kill)
go func() {
if err := cmd.Execute(); err != nil {
log.Fatal(err)
}
}()
sig := <-c
log.Println("GOT SIGNAL: " + sig.String())
}