Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow custom endpoint URL. #33

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open

Conversation

kivutar
Copy link

@kivutar kivutar commented Jan 3, 2018

Attempt to address #31
Websocket subscriptions are now working.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.2%) to 87.5% when pulling 593f69e on Kivutar:master into cc93f95 on graphql-go:master.

@coveralls
Copy link

Coverage Status

Coverage decreased (-1.4%) to 85.876% when pulling 69f77bc on Kivutar:master into cc93f95 on graphql-go:master.

1 similar comment
@coveralls
Copy link

Coverage Status

Coverage decreased (-1.4%) to 85.876% when pulling 69f77bc on Kivutar:master into cc93f95 on graphql-go:master.

Copy link

@Jannis Jannis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd recommend separating the GraphiQL configuration parameters from the handler configuration a bit. Apart from that this looks great!

handler.go Outdated
Pretty bool
GraphiQL bool
EndpointURL string
SubscriptionsEndpoint string
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of making EndpointURL and SubscriptionsEndpoint top-level configuration fields, it would probably be cleaner to group them under a GraphiQLConfig field that can optionally be passed in together with GraphiQL: true. Example:

handler.New(&handler.Config{
    Schema: ...,
    GraphiQL: true,
    GraphiQLConfig: &handler.GraphiQLConfig{
        Endpoint: ...,
        SubscriptionsEndpoint: ...,
    }
})

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I noticed that the Apollo server code for GraphiQL mentioned in #31 has a few more configuration variables that might make sense to add here (like additional HTTP headers to be passed to the endpoint for e.g. authentication).

graphiql.go Outdated
OperationName string
EndpointURL template.URL
EndpointURLWS template.URL
SubscriptionsEndpoint template.URL
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only EndpointURLWS is being used in the template, SubscriptionsEndpoint isn't. I personally favor the name SubscriptionsEndpoint and would pass Endpoint and SubscriptionsEndpoint (falling back to Endpoint if not set) in to the template.

@coveralls
Copy link

Coverage Status

Coverage decreased (-1.5%) to 85.795% when pulling aace1d0 on Kivutar:master into cc93f95 on graphql-go:master.

1 similar comment
@coveralls
Copy link

Coverage Status

Coverage decreased (-1.5%) to 85.795% when pulling aace1d0 on Kivutar:master into cc93f95 on graphql-go:master.

@kivutar
Copy link
Author

kivutar commented Jan 5, 2018

Thanks for your reviews.

If I use a pointer for GraphiQLConfig I have to handle too many pointer dereferences in order to access the values. (I'm a golang beginner)

And if I use a plain struct, my changes are not consistent anymore with the current code, as handler.Config is a pointer.

What should I do?

@coveralls
Copy link

coveralls commented Jan 5, 2018

Coverage Status

Coverage decreased (-1.5%) to 85.795% when pulling d34f105 on Kivutar:master into cc93f95 on graphql-go:master.

@coveralls
Copy link

coveralls commented Jan 5, 2018

Coverage Status

Coverage decreased (-1.5%) to 85.795% when pulling 9041423 on Kivutar:master into cc93f95 on graphql-go:master.

@ccamel
Copy link

ccamel commented May 11, 2018

@kivutar What's the status on this one ? I'd be really interested in having this feature available. 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants