diff --git a/go.mod b/go.mod index e39d012..e547c4c 100644 --- a/go.mod +++ b/go.mod @@ -4,6 +4,7 @@ go 1.20 require ( github.com/google/uuid v1.3.0 // indirect + github.com/graphql-go/graphql v0.8.1 // indirect github.com/mattn/go-colorable v0.1.12 // indirect github.com/mattn/go-isatty v0.0.14 // indirect github.com/rs/zerolog v1.29.1 // indirect diff --git a/go.sum b/go.sum index 5d5a432..6620914 100644 --- a/go.sum +++ b/go.sum @@ -9,6 +9,8 @@ github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/graph-gophers/graphql-go v1.5.0 h1:fDqblo50TEpD0LY7RXk/LFVYEVqo3+tXMNMPSVXA1yc= github.com/graph-gophers/graphql-go v1.5.0/go.mod h1:YtmJZDLbF1YYNrlNAuiO5zAStUWc3XZT07iGsVqe1Os= +github.com/graphql-go/graphql v0.8.1 h1:p7/Ou/WpmulocJeEx7wjQy611rtXGQaAcXGqanuMMgc= +github.com/graphql-go/graphql v0.8.1/go.mod h1:nKiHzRM0qopJEwCITUuIsxk9PlVlwIiiI8pnJEhordQ= github.com/looplab/fsm v1.0.1 h1:OEW0ORrIx095N/6lgoGkFkotqH6s7vaFPsgjLAaF5QU= github.com/looplab/fsm v1.0.1/go.mod h1:PmD3fFvQEIsjMEfvZdrCDZ6y8VwKTwWNjlpEr6IKPO4= github.com/mattn/go-colorable v0.1.12 h1:jF+Du6AlPIjs2BiUiQlKOX0rt3SujHxPnksPKZbaA40= diff --git a/graph.go b/graph.go index f5e4a1a..44af18c 100644 --- a/graph.go +++ b/graph.go @@ -40,7 +40,7 @@ func (logger * DefaultLogger) Init(components []string) error { } writer := io.MultiWriter(file, os.Stdout) - for _, c := range(all_components) { + for _, c := range([]string{"event"}) { if component_enabled(c) == true { logger.loggers[c] = zerolog.New(writer).With().Timestamp().Str("component", c).Logger() } diff --git a/main.go b/main.go index 36502c2..91b0902 100644 --- a/main.go +++ b/main.go @@ -273,6 +273,11 @@ func main() { } } }() + + go func() { + event_manager.GQL() + }() + log.Logf("test", "Starting event_manager") err := event_manager.Run() if err != nil { diff --git a/manager.go b/manager.go index 43c9225..79d5f80 100644 --- a/manager.go +++ b/manager.go @@ -3,6 +3,11 @@ package main import ( "fmt" "errors" + + "io" + "net/http" + "github.com/graphql-go/graphql" + "github.com/graphql-go/handler" ) type EventManager struct { @@ -11,6 +16,96 @@ type EventManager struct { aborts []chan error } +graphiql_string := ` + + + +
+