Graphql-code-generator: Support Environment Variables for schema headers in config

Created on 1 Nov 2019  路  4Comments  路  Source: dotansimha/graphql-code-generator

Problem is i cannot use codegen against an authenticated server without resorting to javascript schema file.

eg.

schema:
  - http://localhost:8080/v1/graphql:
      headers:
        x-hasura-admin-secret: "${env:HASURA_GRAPHQL_ADMIN_SECRET}"

would love to be able to specify an env var in the config yml rather than having to create a schema.js to provide the authenticated schema

Most helpful comment

https://graphql-code-generator.com/docs/getting-started/codegen-config#environment-variables
We already support environmental variables in codegen.yml file.

All 4 comments

https://graphql-code-generator.com/docs/getting-started/codegen-config#environment-variables
We already support environmental variables in codegen.yml file.

@andycmaj As @ardatan said, you can use env vars in your yaml files. Also, we support .js file with module.exports as config file.

thanks! dunno how i missed that... appreciate the response

you guys are awesome. thanks for your hard work

Was this page helpful?
0 / 5 - 0 ratings