forked from ehazlett/interlock
/
spec.go
42 lines (35 loc) · 850 Bytes
/
spec.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
package main
import (
"os"
"github.com/BurntSushi/toml"
log "github.com/Sirupsen/logrus"
"github.com/codegangsta/cli"
"github.com/ehazlett/interlock/config"
)
var cmdSpec = cli.Command{
Name: "spec",
Usage: "generate a configuration file",
Action: specAction,
}
func specAction(c *cli.Context) {
ec := &config.ExtensionConfig{
Name: "nginx",
ConfigPath: "/etc/conf/nginx.conf",
PidPath: "/etc/conf/nginx.pid",
BackendOverrideAddress: "",
}
if err := config.SetConfigDefaults(ec); err != nil {
log.Fatal(err)
}
cfg := &config.Config{
ListenAddr: ":8080",
DockerURL: "unix:///var/run/docker.sock",
EnableMetrics: true,
Extensions: []*config.ExtensionConfig{
ec,
},
}
if err := toml.NewEncoder(os.Stdout).Encode(cfg); err != nil {
log.Fatal(err)
}
}