Initial cloud-services repo - gateway service + pkg modules
This commit is contained in:
44
services/gateway/main.go
Normal file
44
services/gateway/main.go
Normal file
@@ -0,0 +1,44 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"gateway/controllers"
|
||||
"gateway/server"
|
||||
"gateway/services"
|
||||
"gateway/sloppy"
|
||||
|
||||
"fiskerinc.com/modules/logger"
|
||||
"fiskerinc.com/modules/tracer"
|
||||
"fiskerinc.com/modules/utils/app"
|
||||
)
|
||||
|
||||
func init() {
|
||||
app.Setup("gateway", cleanup)
|
||||
}
|
||||
|
||||
func main() {
|
||||
defer cleanup()
|
||||
|
||||
tracer.Start()
|
||||
defer tracer.Stop()
|
||||
|
||||
const port string = ":8077"
|
||||
const kafkaTopic string = "ota_update"
|
||||
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
defer cancel()
|
||||
// Initiate vin blocking list early
|
||||
sloppy.GetVINBlocker()
|
||||
|
||||
go controllers.HealthCheck()
|
||||
go server.StartRedisQueue(ctx)
|
||||
go server.StartRedisSubscriptions(ctx)
|
||||
go services.GetConnections().RunExpiration(ctx)
|
||||
go server.StartHTTP(ctx, port)
|
||||
select {}
|
||||
}
|
||||
|
||||
func cleanup() {
|
||||
logger.Close()
|
||||
}
|
||||
Reference in New Issue
Block a user