-
Notifications
You must be signed in to change notification settings - Fork 9
/
main.go
112 lines (106 loc) · 2.02 KB
/
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
package main
import (
"log"
"os"
"github.com/urfave/cli"
)
func main() {
app := cli.NewApp()
app.Name = "n0core API"
// app.Usage = ""
app.Version = "0.1.0" // CIで取るようにする
app.Commands = []cli.Command{
{
Name: "node",
Usage: "",
Action: ServeNodeAPI,
Flags: []cli.Flag{
cli.StringFlag{
Name: "etcd-endpoints",
},
cli.StringFlag{
// interfaceからも取れるようにしたい
Name: "bind-address",
Value: "0.0.0.0",
},
cli.IntFlag{
Name: "bind-port",
Value: 20181,
},
},
},
{
Name: "network",
Usage: "",
Action: ServeNetworkAPI,
Flags: []cli.Flag{
cli.StringFlag{
Name: "etcd-endpoints",
},
cli.StringFlag{
// interfaceからも取れるようにしたい
Name: "bind-address",
Value: "0.0.0.0",
},
cli.IntFlag{
Name: "bind-port",
Value: 20182,
},
},
},
{
Name: "block_storage",
Usage: "",
Action: ServeBlockStorageAPI,
Flags: []cli.Flag{
cli.StringFlag{
Name: "etcd-endpoints",
},
cli.StringFlag{
// interfaceからも取れるようにしたい
Name: "bind-address",
Value: "0.0.0.0",
},
cli.IntFlag{
Name: "bind-port",
Value: 20183,
},
cli.StringFlag{
Name: "node-api-endpoint",
},
},
},
{
Name: "virtual_machine",
Usage: "",
Action: ServeVirtualMachineAPI,
Flags: []cli.Flag{
cli.StringFlag{
Name: "etcd-endpoints",
},
cli.StringFlag{
// interfaceからも取れるようにしたい
Name: "bind-address",
Value: "0.0.0.0",
},
cli.IntFlag{
Name: "bind-port",
Value: 20184,
},
cli.StringFlag{
Name: "node-api-endpoint",
},
cli.StringFlag{
Name: "network-api-endpoint",
},
cli.StringFlag{
Name: "block-storage-api-endpoint",
},
},
},
}
log.SetFlags(log.Lshortfile)
if err := app.Run(os.Args); err != nil {
log.Fatalf("Failed to start process, err:%v", err.Error())
}
}