oc-schedulerd/main.go

47 lines
970 B
Go
Raw Permalink Normal View History

2023-10-18 17:08:53 +02:00
package main
import (
"fmt"
2023-10-18 17:08:53 +02:00
"os"
"time"
"github.com/goraz/onion"
"github.com/rs/zerolog"
)
var log zerolog.Logger
func main() {
output := zerolog.ConsoleWriter{Out: os.Stdout, TimeFormat: time.RFC3339}
log = zerolog.New(output).With().Timestamp().Logger()
var o *onion.Onion
l2 := onion.NewEnvLayerPrefix("_", "OC-SCHED")
l1, err := onion.NewFileLayer("config.json", nil)
if err != nil {
log.Info().Msg("no config file found, using env")
o = onion.New(l2)
} else {
o = onion.New(l1, l2)
}
loglevel := o.GetStringDefault("loglevel", "info")
apiurl := o.GetStringDefault("apiurl", "http://localhost:49618/")
_ = loglevel
var g Graph
2023-10-18 17:08:53 +02:00
list, err := g.GetGraphList(apiurl)
if err != nil {
log.Fatal().Msg("Failed to get the workspaces list, check api url and that api server is up : " + apiurl)
}
for workspace, _ := range list {
println(workspace)
}
g.LoadFrom(list["test-alpr"])
2024-05-03 10:58:06 +02:00
g.ExportToArgo("test-alpr")
fmt.Print("stop")
2023-10-18 17:08:53 +02:00
}