mirror of
https://github.com/lukaszraczylo/go-simple-graphql.git
synced 2026-10-13 00:48:37 +00:00
Attempt to fix the graphQL endpoint setup.
This commit is contained in:
@@ -6,6 +6,7 @@ require (
|
||||
github.com/andybalholm/brotli v1.0.2 // indirect
|
||||
github.com/davecgh/go-spew v1.1.1 // indirect
|
||||
github.com/klauspost/compress v1.12.2 // indirect
|
||||
github.com/lukaszraczylo/zero v0.0.0-20160322155811-4a4535dd56e7
|
||||
github.com/stretchr/testify v1.7.0
|
||||
github.com/tidwall/gjson v1.8.0
|
||||
github.com/valyala/fasthttp v1.24.0
|
||||
|
||||
@@ -8,6 +8,8 @@ github.com/golang/snappy v0.0.3/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEW
|
||||
github.com/klauspost/compress v1.11.8/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs=
|
||||
github.com/klauspost/compress v1.12.2 h1:2KCfW3I9M7nSc5wOqXAlW2v2U6v+w6cbjvbfp+OykW8=
|
||||
github.com/klauspost/compress v1.12.2/go.mod h1:8dP1Hq4DHOhN9w426knH3Rhby4rFm6D8eO+e+Dq5Gzg=
|
||||
github.com/lukaszraczylo/zero v0.0.0-20160322155811-4a4535dd56e7 h1:9l31ZdbJuSK5sQH4hldeHB/ulflee5srCFzT4Oxm65Q=
|
||||
github.com/lukaszraczylo/zero v0.0.0-20160322155811-4a4535dd56e7/go.mod h1:UOwgylrs4V/Vzo1KfbjhzU+iB/5Pu4HnSpgE8WI14gs=
|
||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||
|
||||
@@ -11,6 +11,7 @@ import (
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
"github.com/lukaszraczylo/zero"
|
||||
"github.com/tidwall/gjson"
|
||||
"github.com/valyala/fasthttp"
|
||||
)
|
||||
@@ -27,10 +28,12 @@ type requestBase struct {
|
||||
|
||||
func prepare() {
|
||||
value, present := os.LookupEnv("GRAPHQL_ENDPOINT")
|
||||
if GraphQLUrl == "" && present {
|
||||
if present {
|
||||
GraphQLUrl = value
|
||||
} else if GraphQLUrl == "" && !present {
|
||||
} else if zero.IsZero(GraphQLUrl) && !present {
|
||||
GraphQLUrl = "http://127.0.0.1:9090/v1/graphql"
|
||||
} else {
|
||||
fmt.Println("GraphQL endpoint not set.")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -146,8 +146,8 @@ func (suite *TestSuite) Test_initialize() {
|
||||
},
|
||||
{
|
||||
name: "Setting custom endpoint (VAR)",
|
||||
local_endpoint: "http://127.0.0.1:8080/v1/graphql",
|
||||
expected: "http://127.0.0.1:8080/v1/graphql",
|
||||
local_endpoint: "http://127.0.0.1:8090/v1/graphql",
|
||||
expected: "http://127.0.0.1:8090/v1/graphql",
|
||||
},
|
||||
{
|
||||
name: "Setting custom endpoint (VAR)",
|
||||
|
||||
Reference in New Issue
Block a user