mirror of
https://github.com/outbackdingo/matchbox.git
synced 2026-01-27 10:19:35 +00:00
api: Add Groups and GroupConfig with Requirements and Labels
* Add Group definitions to associate attribute matchers to particular Spec specifications to supercede use of machine.json files
This commit is contained in:
@@ -2,6 +2,7 @@ package main
|
||||
|
||||
import (
|
||||
"flag"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"os"
|
||||
@@ -17,6 +18,7 @@ var log = capnslog.NewPackageLogger("github.com/coreos/coreos-baremetal/cmd/boot
|
||||
func main() {
|
||||
flags := flag.NewFlagSet("bootcfg", flag.ExitOnError)
|
||||
address := flags.String("address", "127.0.0.1:8080", "HTTP listen address")
|
||||
configPath := flags.String("config", "", "Path to config file")
|
||||
dataPath := flags.String("data-path", "./data", "Path to data directory")
|
||||
imagesPath := flags.String("images-path", "./images", "Path to static assets")
|
||||
// available log levels https://godoc.org/github.com/coreos/pkg/capnslog#LogLevel
|
||||
@@ -44,13 +46,28 @@ func main() {
|
||||
// logging setup
|
||||
lvl, err := capnslog.ParseLevel(strings.ToUpper(*logLevel))
|
||||
if err != nil {
|
||||
log.Fatalf("Invalid log-level: %s", err.Error())
|
||||
log.Fatalf("Invalid log-level: %v", err.Error())
|
||||
}
|
||||
capnslog.SetGlobalLogLevel(lvl)
|
||||
capnslog.SetFormatter(capnslog.NewPrettyFormatter(os.Stdout, false))
|
||||
|
||||
// storage
|
||||
store := api.NewFileStore(http.Dir(*dataPath))
|
||||
|
||||
// bootstrap a group config
|
||||
if *configPath != "" {
|
||||
data, err := ioutil.ReadFile(*configPath)
|
||||
if err != nil {
|
||||
log.Fatalf("error reading config file: %v", err)
|
||||
}
|
||||
_, err = api.ParseGroupConfig(data)
|
||||
if err != nil {
|
||||
log.Fatalf("error parsing group config: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
config := &api.Config{
|
||||
Store: api.NewFileStore(http.Dir(*dataPath)),
|
||||
Store: store,
|
||||
ImagePath: *imagesPath,
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user