-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathmain.go
More file actions
44 lines (34 loc) · 1.17 KB
/
main.go
File metadata and controls
44 lines (34 loc) · 1.17 KB
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"
"github.com/ONEST-Network/Job-Manager-Adapter/pkg/clients"
"github.com/ONEST-Network/Job-Manager-Adapter/pkg/config"
"github.com/ONEST-Network/Job-Manager-Adapter/pkg/log"
"github.com/ONEST-Network/Job-Manager-Adapter/pkg/proxy"
"github.com/ONEST-Network/Job-Manager-Adapter/pkg/server"
"github.com/ONEST-Network/Job-Manager-Adapter/pkg/utils"
"github.com/kelseyhightower/envconfig"
"github.com/sirupsen/logrus"
)
func main() {
// init logrus logger
log.InitLogger()
// log runtime attributes
utils.LogRuntimeAttributes()
// parse env variables
if err := envconfig.Process("", &config.Config); err != nil {
logrus.Fatalf("Failed to parse ENVs, %v", err)
}
// set proxy envs, if provided
proxy.SetProxyENVs()
// Initialize mongodb clients
businessClient, jobClient, jobApplicationClient, initJobApplication := server.InitMongoDB()
// Set up clients
clients := clients.NewClients(jobClient, businessClient, jobApplicationClient, initJobApplication)
// initialize the server
server := server.SetupServer(clients)
// start the server
if err := server.Run(fmt.Sprintf(":%s", config.Config.HTTPPort)); err != nil {
logrus.Fatal(err)
}
}