Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ require (
github.com/eclipse/paho.mqtt.golang v1.2.0
github.com/evanphx/json-patch/v5 v5.1.0
github.com/go-test/deep v1.0.4
github.com/gobuffalo/packr v1.30.1
github.com/gobwas/ws v1.0.4
github.com/golang/mock v1.4.1
github.com/google/go-cmp v0.5.6
Expand Down Expand Up @@ -47,16 +46,13 @@ require (
github.com/Masterminds/sprig v2.22.0+incompatible // indirect
github.com/agnivade/levenshtein v1.1.1 // indirect
github.com/fsnotify/fsnotify v1.4.9 // indirect
github.com/gobuffalo/envy v1.7.0 // indirect
github.com/gobuffalo/packd v0.3.0 // indirect
github.com/gobwas/httphead v0.0.0-20180130184737-2c6c146eadee // indirect
github.com/gobwas/pool v0.2.0 // indirect
github.com/google/uuid v1.1.1 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/huandu/xstrings v1.2.1 // indirect
github.com/imdario/mergo v0.3.8 // indirect
github.com/inconshreveable/mousetrap v1.0.0 // indirect
github.com/joho/godotenv v1.3.0 // indirect
github.com/klauspost/compress v1.13.1 // indirect
github.com/konsorten/go-windows-terminal-sequences v1.0.2 // indirect
github.com/logrusorgru/aurora v0.0.0-20200102142835-e9ef32dff381 // indirect
Expand All @@ -72,7 +68,6 @@ require (
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/qri-io/jsonpointer v0.1.1 // indirect
github.com/rogpeppe/go-internal v1.3.0 // indirect
github.com/sirupsen/logrus v1.4.2 // indirect
github.com/spf13/afero v1.6.0 // indirect
github.com/spf13/cast v1.3.0 // indirect
Expand Down
5 changes: 0 additions & 5 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,9 @@ github.com/go-playground/validator/v10 v10.2.0 h1:KgJ0snyC2R9VXYN2rneOtQcw5aHQB1
github.com/go-playground/validator/v10 v10.2.0/go.mod h1:uOYAAleCW8F/7oMFd6aG0GOhaH6EGOAJShg8Id5JGkI=
github.com/go-test/deep v1.0.4 h1:u2CU3YKy9I2pmu9pX0eq50wCgjfGIt539SqR7FbHiho=
github.com/go-test/deep v1.0.4/go.mod h1:wGDj63lr65AM2AQyKZd/NYHGb0R+1RLqB8NKt3aSFNA=
github.com/gobuffalo/envy v1.7.0 h1:GlXgaiBkmrYMHco6t4j7SacKO4XUjvh5pwXh0f4uxXU=
github.com/gobuffalo/envy v1.7.0/go.mod h1:n7DRkBerg/aorDM8kbduw5dN3oXGswK5liaSCx4T5NI=
github.com/gobuffalo/logger v1.0.0/go.mod h1:2zbswyIUa45I+c+FLXuWl9zSWEiVuthsk8ze5s8JvPs=
github.com/gobuffalo/packd v0.3.0 h1:eMwymTkA1uXsqxS0Tpoop3Lc0u3kTfiMBE6nKtQU4g4=
github.com/gobuffalo/packd v0.3.0/go.mod h1:zC7QkmNkYVGKPw4tHpBQ+ml7W/3tIebgeo1b36chA3Q=
github.com/gobuffalo/packr v1.30.1 h1:hu1fuVR3fXEZR7rXNW3h8rqSML8EVAf6KNm0NKO/wKg=
github.com/gobuffalo/packr v1.30.1/go.mod h1:ljMyFO2EcrnzsHsN99cvbq055Y9OhRrIaviy289eRuk=
github.com/gobuffalo/packr/v2 v2.5.1/go.mod h1:8f9c96ITobJlPzI44jj+4tHnEKNt0xXWSVlXRN9X1Iw=
github.com/gobwas/httphead v0.0.0-20180130184737-2c6c146eadee h1:s+21KNqlpePfkah2I+gwHF8xmJWRjooY+5248k6m4A0=
Expand Down Expand Up @@ -129,7 +126,6 @@ github.com/jensneuse/graphql-go-tools v1.20.2/go.mod h1:9e2CqUwCY2lvC7PWnvvOjH2X
github.com/jensneuse/pipeline v0.0.0-20200117120358-9fb4de085cd6 h1:y8hvuqbuVGFNpEos+vB5I5X+QxWm0uyTk+5oeOinMjY=
github.com/jensneuse/pipeline v0.0.0-20200117120358-9fb4de085cd6/go.mod h1:UsfzaMt+keVOxa007GcCJMFeTHr6voRfBGMQEW7DkdM=
github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI=
github.com/joho/godotenv v1.3.0 h1:Zjp+RcGpHhGlrMbJzXTrZZPrWj+1vfm90La1wgB6Bhc=
github.com/joho/godotenv v1.3.0/go.mod h1:7hK45KPybAkOC6peb+G5yklZfMxEjkZhHbwpqxOKXbg=
github.com/json-iterator/go v1.1.9 h1:9yzud/Ht36ygwatGx56VwCZtlI/2AD15T1X2sjSuGns=
github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
Expand Down Expand Up @@ -214,7 +210,6 @@ github.com/qri-io/jsonpointer v0.1.1/go.mod h1:DnJPaYgiKu56EuDp8TU5wFLdZIcAnb/uH
github.com/qri-io/jsonschema v0.2.1 h1:NNFoKms+kut6ABPf6xiKNM5214jzxAhDBrPHCJ97Wg0=
github.com/qri-io/jsonschema v0.2.1/go.mod h1:g7DPkiOsK1xv6T/Ao5scXRkd+yTFygcANPBaaqW+VrI=
github.com/rogpeppe/go-internal v1.1.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
github.com/rogpeppe/go-internal v1.3.0 h1:RR9dF3JtopPvtkroDZuVD7qquD0bnHlKSqaQhgwt8yk=
github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
github.com/rs/cors v1.6.0/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU=
github.com/rs/cors v1.7.0/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU=
Expand Down
15 changes: 0 additions & 15 deletions pkg/playground/a_playground-packr.go

This file was deleted.

17 changes: 8 additions & 9 deletions pkg/playground/playground.go
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
//go:generate packr

// Package playground is a http.Handler hosting the GraphQL Playground application.
package playground

import (
"embed"
"fmt"
"html/template"
"net/http"
"path"
"strings"

"github.com/gobuffalo/packr"
)

const (
Expand All @@ -27,6 +25,9 @@ const (
logoFile = "logo.png"
)

//go:embed files/*
var files embed.FS

// Config is the configuration Object to instruct ConfigureHandlers on how to setup all the http Handlers for the playground
type Config struct {
// PathPrefix is a prefix you intend to put in front of all handlers
Expand Down Expand Up @@ -76,7 +77,6 @@ func (h *Handlers) add(path string, handler http.HandlerFunc) {
// Playground manages the configuration of all HTTP handlers responsible for serving the GraphQL Playground
type Playground struct {
cfg Config
box packr.Box
files []fileConfig
data playgroundTemplateData
}
Expand Down Expand Up @@ -121,7 +121,6 @@ func New(config Config) *Playground {

return &Playground{
cfg: config,
box: packr.NewBox("./files"),
files: files,
data: data,
}
Expand All @@ -145,11 +144,11 @@ func (p *Playground) Handlers() (handlers Handlers, err error) {
}

func (p *Playground) configurePlaygroundHandler(handlers *Handlers) (err error) {
playgroundHTML, err := p.box.FindString("playground.html")
playgroundHTML, err := files.ReadFile("files/playground.html")
if err != nil {
return
}
templates, err := template.New(playgroundTemplate).Parse(playgroundHTML)
templates, err := template.New(playgroundTemplate).Parse(string(playgroundHTML))
if err != nil {
return
}
Expand All @@ -173,7 +172,7 @@ func (p *Playground) configurePlaygroundHandler(handlers *Handlers) (err error)
}

func (p *Playground) configureFileHandler(handlers *Handlers, file fileConfig) error {
data, err := p.box.Find(file.name)
data, err := files.ReadFile(fmt.Sprintf("files/%s", file.name))
if err != nil {
return err
}
Expand Down