-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.go
44 lines (33 loc) · 818 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
43
44
package main
import (
"fmt"
"log"
"os"
"github.com/joho/godotenv"
api "github.com/joshjms/pocket-watch/src"
"github.com/joshjms/pocket-watch/src/consts"
"github.com/joshjms/pocket-watch/src/isolate"
"github.com/joshjms/pocket-watch/src/rpc"
)
func main() {
var err error
err = godotenv.Load()
if err != nil {
errorMsg := fmt.Sprintf("Failed to load environment variables: %v", err)
log.Fatal(errorMsg)
}
err = consts.Init()
if err != nil {
errorMsg := fmt.Sprintf("Failed to load environment variables: %v", err)
log.Fatal(errorMsg)
}
isolate.InitQueueManager()
if os.Getenv("RPC_ENABLE") == "TRUE" {
err = rpc.StartServer()
if err != nil {
log.Fatal(err)
}
log.Print(fmt.Sprintf("Running gRPC server on port %d", consts.GetConsts().RPCConfig.Port))
}
api.StartAPI()
}