-
Notifications
You must be signed in to change notification settings - Fork 116
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to use environment variables in config.yml #921
Comments
@yo-gen this should be supported. Can you provide a complete example YAML file that has this problem? And the output (if you've got it)? Perhaps there is some nesting issue or something. and can you verify that Perhaps you're running it in a child process or shell that does not have the |
I was running from the shell, using npx command
If this is the required format, maybe it would be good to have an example somewhere. |
It should actually work with either I will add an example next time I'm in here doing some updates. |
I've also stumbled across this issue looking for a way to set environment variables in my spectaql:
logoFile: public/images/logo_extended.svg
faviconFile: public/favicon.ico
embedFavicon: true
introspection:
url: '${APPSYNC_GRAPHQLENDPOINT}'
headers:
x-api-key: '${APPSYNC_APIKEY}'
info:
title: GraphQL API Reference
description: >-
## Welcome to the party!
Apparently, as mentioned by @newhouse the environment variables are not available when I run Do you have any idea how I could pass these environment variables to the shell command? The only solution I've found so far is to run a script that reads the variables, sets them in the config file, runs the command and then replaces these environment variables with placeholders again. Thanks for any help! |
Another solution would be to export the environment variables to shell variables like so: export APPSYNC_GRAPHQLENDPOINT=$(grep APPSYNC_GRAPHQLENDPOINT .env.local | cut -d '=' -f2)
export APPSYNC_APIKEY=$(grep APPSYNC_APIKEY .env.local | cut -d '=' -f2)
npx spectaql config.yml |
I am not able to figure how to pass the environment variables to config.yml file.
Already tried following variations
url: REACT_APP_API_URL/top/graphql
url: 'REACT_APP_API_URL/top/graphql'
url: 'REACT_APP_API_URL'/top/graphql
url: ${REACT_APP_API_URL}/top/graphql
url: '${REACT_APP_API_URL}/top/graphql'
None of it works :/
The text was updated successfully, but these errors were encountered: