-
Notifications
You must be signed in to change notification settings - Fork 35
/
config.go
50 lines (47 loc) · 1.01 KB
/
config.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
package main
import (
"encoding/json"
"os"
"github.com/codegangsta/cli"
)
var configCommand = cli.Command{
Name: "config",
Usage: "output default config",
Flags: []cli.Flag{
cli.StringFlag{
Name: "node-id",
Usage: "node id",
Value: getHostname(),
EnvVar: "STELLAR_CONFIG_NODE_ID",
},
cli.StringFlag{
Name: "nic, n",
Usage: "network interface to use for detecting IP (default: first non-local)",
EnvVar: "STELLAR_CONFIG_NIC",
},
cli.StringSliceFlag{
Name: "peer, p",
Usage: "peer(s) to configure for joining",
Value: &cli.StringSlice{},
EnvVar: "STELLAR_CONFIG_PEERS",
},
cli.StringFlag{
Name: "namespace",
Usage: "containerd namespace",
Value: "default",
EnvVar: "CONTAINERD_NAMESPACE",
},
},
Action: func(ctx *cli.Context) error {
cfg, err := defaultConfig(ctx)
if err != nil {
return err
}
enc := json.NewEncoder(os.Stdout)
enc.SetIndent("", " ")
if err := enc.Encode(cfg); err != nil {
return err
}
return nil
},
}