Skip to main content
Version: v3.x (DDN)

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.

supergraph-development.yaml
kind: Supergraph
version: v2
definition:
subgraphs:
- globals/subgraph-development.yaml
- my_subgraph/subgraph.yaml
globals/subgraph-development.yaml
kind: Subgraph
version: v2
definition:
name: globals
generator:
rootPath: .
includePaths:
- metadata_development
globals/metadata_development/auth-config.hml
kind: AuthConfig
version: v2
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.