-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathmain.go
More file actions
40 lines (32 loc) · 732 Bytes
/
main.go
File metadata and controls
40 lines (32 loc) · 732 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
package main
import (
"bytes"
"fmt"
"os"
"os/exec"
"strings"
"github.com/gokultp/galera_web_ui/apis"
)
func main() {
// getting docker daemon api version
cmd := exec.Command("docker", "version", "--format", "{{.Server.APIVersion}}")
cmdOutput := &bytes.Buffer{}
cmd.Stdout = cmdOutput
err := cmd.Run()
if err != nil {
fmt.Println("Something went wrong, start docker if you are not running.")
panic(err)
}
apiVersion := strings.TrimSpace(string(cmdOutput.Bytes()))
fmt.Println("supported api version", apiVersion)
// setting env variable
os.Setenv("DOCKER_API_VERSION", apiVersion)
api, err := apis.NewAPI()
if err != nil {
panic(err)
}
err = api.Listen(":3000")
if err != nil {
panic(err)
}
}