graphql-mesh icon indicating copy to clipboard operation
graphql-mesh copied to clipboard

Configuring introspection on/off via .meshrc.yml file

Open iamcdonald opened this issue 3 years ago • 1 comments

Is your feature request related to a problem? Please describe. Disabling GraphQL introspection. We'd currently like to be able to run graphql-mesh with introspection on/off based on context/environment. Having looked through it would appear this is possible via graphql-helix (as outlined here) but isn't exposed through graphql-mesh (validationRules isn't passed here).

Describe the solution you'd like Be able to pass configure introspection on/off via the .meshrc.yml file.

Describe alternatives you've considered The one thing I've spotted is the ability to point introspection at a JSON file via config. I guessing this could be an empty JSON file(?) but it seems like a work-around. However, this doesn't seem to be available with grpc sources/I'm finding it a bit hard to decipher where exactly it would need to be present within the .meshrc.yml file from the documentation.

Hopefully I'm not missing something obvious.

Thanks

iamcdonald avatar Jan 06 '22 09:01 iamcdonald

It would be nice if I could configure a custom function to decide whether the introspection can or cannot be done. For example, my function could check if the user sent a specific authorization token, etc.

alanwillms avatar Apr 04 '22 12:04 alanwillms

I second that an introspection configuration option would be really nice!

For the time being I managed to disable it with @envelop/disable-introspection. Here's my setup:

// lib/plugins/index.ts
import { Plugin } from '@envelop/core'
import { useDisableIntrospection } from '@envelop/disable-introspection'
 
const plugins: Plugin[] = [
    useDisableIntrospection()
]
 
export default plugins
# .meshrc.yml
serve:
  playground: false # Ideally we would look at node_env or environment variable to set this to true for non-prod, and true for prod

additionalEnvelopPlugins: './lib/plugins/index.ts'

I haven't yet solved how to pass in a boolean environment variable to playground, since env variables are always strings.

robertrosman avatar Mar 29 '23 09:03 robertrosman