-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.go
More file actions
31 lines (24 loc) · 641 Bytes
/
Copy pathapp.go
File metadata and controls
31 lines (24 loc) · 641 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
package main
import (
"os"
"borgmon.me/state-proxy/controller"
"borgmon.me/state-proxy/docker"
"borgmon.me/state-proxy/helper"
"github.com/docker/docker/client"
"github.com/gin-gonic/gin"
)
func main() {
r := gin.Default()
cli, err := client.NewClientWithOpts(client.FromEnv)
helper.PanicIfError(err)
dockerService := &docker.DockerServiceImpl{
Client: cli,
}
stateHandler := &controller.StateHandlerImpl{
DockerService: dockerService,
Whitelist: helper.ParseCSVSlice(os.Getenv("WHITELIST")),
}
r.GET("/state/:name", stateHandler.GetState)
r.SetTrustedProxies(nil)
r.Run(helper.GetPort(os.Getenv("PORT")))
}