Urigo / graphql-cli

📟 Command line tool for common GraphQL development workflows

Home Page:https://graphql-cli.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Override config for playground

bmayen opened this issue · comments

Is your feature request related to a problem? Please describe.
When dockerizing prisma server and my api as separate containers, my prisma.yml under my api service looks like

endpoint: http://prisma-server:4466
datamodel: datamodel.graphql
hooks:
  post-deploy:
  - graphql get-schema
  - graphql codegen

and .graphqlconfig.yml is

projects:
  app:
    schemaPath: ./__generated__/app-schema.graphql
    extensions:
      endpoints:
        default: http://localhost:7071/api/graphql
  db:
    schemaPath: ./__generated__/prisma-schema.graphql
    extensions:
      prisma: ./prisma.yml

endpoint: http://prisma-server:4466 is a reference to the prisma server docker service which runs alongside my api service. localhost in this case refers to the api service which prisma deploy is run from. This works fine for running get-schema. However, when I run graphql playground and access localhost:3000/playground from the host, the db tab points to http://prisma-server:4466 and cannot be found.

Describe the solution you'd like
Would like to be able to override the config for graphql playground so docker host can access services via localhost.

Got this to work simply by changing my config to:

projects:
  app:
    schemaPath: ./__generated__/app-schema.graphql
    extensions:
      endpoints:
        default: http://localhost:7071/api/GraphQLTrigger
  db:
    schemaPath: ./__generated__/prisma-schema.graphql
    extensions:
      endpoints:
        default: http://localhost:4466

Removed the prisma extension and manually added the default endpoint url pointing to localhost. This way, prisma.yml is used within the docker service and points to the linked prisma-server service, while .graphqlconfig.yml is used by playground to point to localhost from the host machine.

I don't think my initial feature request is necessary as it was due to an incomplete understanding on my end, not lack of feature. Would be nice to see this better documented though.