-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathbuilderd.go
39 lines (32 loc) · 1.06 KB
/
builderd.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
package main
import (
"atlantis/builder/api"
"atlantis/builder/docker"
"flag"
"github.com/BurntSushi/toml"
"github.com/jigish/go-flags"
"log"
)
type ServerOpts struct {
ConfigFile string `long:"config-file" default:"/etc/atlantis/builder/server.toml" description:"the config file to use"`
Registry string `long:"registry" default:"localhost" description:"the registry to use")`
}
type BuilderConfig struct {
Registry string `toml:"registry_host"`
}
func main() {
var layerPath = flag.String("layer-path", "/opt/atlantis/builder/layers", "path to overlay layers")
var manifestDir = flag.String("manifest-dir", "/opt/atlantis/builder/manifests", "dir to store manifests")
var port = flag.Int("port", 8080, "port to run on")
flag.Parse()
builderdOpts := &ServerOpts{}
config := &BuilderConfig{}
parser := flags.NewParser(builderdOpts, flags.Default)
parser.Parse()
_, err := toml.DecodeFile(builderdOpts.ConfigFile, config)
if err != nil {
log.Fatalln(err)
}
docker.LogOutput = true
api.New(uint16(*port), config.Registry, *layerPath, *manifestDir).Run()
}