External configuration in GraphQL schema

Hello !

I’m new to DGraph and to GraphQL as well.

If my understanding is correct, most of a DGraph database configuration happens in the schema. This schema is to be versionned along with application code. This raises two problems:

  1. I don’t think it is a good idea to version a JWT signing key written plainly in the # Dgraph.Authorization object (I know I could use a key URL but that clashes with point 2.) ;
  2. The same schema could be used in multiple environments (e.g. local development and production), so I would like to inject some configuration information externally for things like :
    • JWT signing key (or key URL) : I want a dummy key for development and an (actually) secret key or URL to a public key in production ;
    • @custom directive HTTP URL : I’d like to connect to a local endpoint for development and to any relevant endpoint in production ;
    • etc.

Without the ability to inject these configuration information in the schema, one would have to : maintain two almost identical versions of the schema for each environment.

Most blog posts, tutorials and even the documentation do not seem to address this issue (I haven’t even seen anything mentioning that versionning the signing key may not be a good idea) . Maybe I’m getting the management of the schema wrong. Any thoughts or solution to use external configuration (with environment variables for example) when writing a schema ?

Thanks !

1 Like

I think almost everyone agrees here. Hopefully a better solution to this will be available at some point!

1 Like