Alternative Configuration Files per Environment
Introduction
Following on from setting up and managing multiple contexts, you can also specify different configuration files per environment. This is useful if you want to use different setups for each.
Example
For example, if in development you want to use noAuth mode but for staging and production you want to use JWT
mode, you can create a supergraph config file for each environment and then specify the correct file in the context.
In the following example we have a supergraph-development.yaml file which specifies a chain to the
subgraph-development.yaml to the metadata_development directory to include for the metadata which sets the noAuth
mode for development context.
kind: Supergraph
version: v2
definition:
subgraphs:
- globals/subgraph-development.yaml
- my_subgraph/subgraph.yaml
kind: Subgraph
version: v2
definition:
name: globals
generator:
rootPath: .
includePaths:
- metadata_development
kind: AuthConfig
version: v4
definition:
mode:
noAuth:
role: admin
sessionVariables: {}
Then similarly, we would have the supergraph file for the other environments to use which specifies JWT mode in the
auth-config.yaml file. You can read more about auth here.
