package main import ( "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 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["TLE-feed"]) }