Environment variables in .graphql-let.yml
See original GitHub issue(Follow up from #104)
In my setup I have a remote schema from a CMS together with some client only stuff that’s in a local schema definition file. To fetch the CMS schema I need to pass a fresh JWT. Iwould like to be able to set the token in an environment variable so that it doesn’t need to hard coded, nor have to create an intermediate file that graphql-let can use. Coupled with #104 and #49 this would solve the use case quite nicely.
What I have done in the past using graphql-codegen is configuring it something like this:
schema:
- ${GRAPHQL_ENDPOINT}:
headers:
Authorization: Bearer ${ACCESS_TOKEN}
- lib/type-defs.graphqls
[...]
and then passing environment variables which would then be expanded. Does/should this work using graphql-let? Perhaps I’m doing it wrong, but I’m unable to get it to work…
Bonus question: I’m using dotenv-expand
to reference a .env variable within another one, something like this:
CMS_BASE_URL="https://foo.baz.bar"
GRAPHQL_ENDPOINT="${CMS_BASE_URL}/graphql"
Should/could this be supported too?
Issue Analytics
- State:
- Created 3 years ago
- Reactions:2
- Comments:5 (4 by maintainers)
Top GitHub Comments
Hi! That is definitely what we should support as
codegen.yml
does. I’ll check their implementation but PR is always welcome.@zimmicz Hi! Could you try this?
Also, supporting
--require (-r)
option by the graphql-let command can be worth to consider. Feel free to make a PR for the feature.