2023-10-18 17:08:53 +02:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
2024-04-09 11:20:08 +02:00
|
|
|
"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
|
2024-04-09 11:20:08 +02:00
|
|
|
|
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)
|
|
|
|
}
|
2024-04-09 11:20:08 +02:00
|
|
|
|
|
|
|
g.LoadFrom(list["test-alpr"])
|
|
|
|
|
|
|
|
fmt.Print("stop")
|
2023-10-18 17:08:53 +02:00
|
|
|
|
|
|
|
}
|