Skip to content
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

Support variable expansion in more places #1578

Closed
dbanty opened this issue Apr 18, 2023 · 5 comments
Closed

Support variable expansion in more places #1578

dbanty opened this issue Apr 18, 2023 · 5 comments
Labels
feature 🎉 new commands, flags, functionality, and improved error messages triage issues and PRs that need to be triaged
Milestone

Comments

@dbanty
Copy link
Contributor

dbanty commented Apr 18, 2023

Description

Follow-up to #1574 which adds support for router-style variable expansion in introspection_headers within supergraph.yaml only. We could support expansion in more places within that file, as well as potentially other config files.

@dbanty dbanty added feature 🎉 new commands, flags, functionality, and improved error messages triage issues and PRs that need to be triaged labels Apr 18, 2023
@robigan
Copy link

robigan commented May 6, 2023

Yeah this would be cool, I personally need variable expansion in the URLs as some APIs use search parameters to include API keys. Would also be very useful for CI systems where the URL of the deployment of a subgraph isn't known until after a CI instance is allocated.

For example I am deploying a supergrapgh that contains a subgraph that points to my Supabase GraphQL endpoint and another subgraph that points to localhost (which I may want to split into a microservice which may be hosted on a different hostname) which is an Apollo Server that translates GraphQL calls to REST API Calls towards external services. As a developer I wish that both these endpoints be inferred from environment variables as many CI systems make it easier to define process environment variables than other methods. And personally I want my local copy of my .env file to be the single source of truth for configuration of my dev environment across my project(s).

@andrewmclagan
Copy link

Our use case for variable expansion is for routing_url and schema.graphref

example

federation_version: 2
subgraphs:
  analytics:
    routing_url: ${env.ANALYTICS_SUBGRAPH_URL}
    schema:
      graphref: ${env.PLATFORM_GRAPHREF}
      subgraph: analytics

@genesor
Copy link

genesor commented Jun 2, 2023

It would be nice to have variable in expansion in routing_url and schema.subgraph_url as well.

This could be useful when you have an URL that can change depending on the environment you're running the command.

We are currently bypassing this by running a sed before executing rover.

subgraphs:
  people:
    routing_url: ${env.LB_ADDR}/people/graphql
    schema:
      subgraph_url: ${env.LB_ADDR}/people/graphql

@the-ress
Copy link

This should be marked as breaking change - it breaks things when someone already had ${foo} in supergraph.yaml, expecting it to be passed through unchanged.

@dbanty
Copy link
Contributor Author

dbanty commented Jun 20, 2023

Thanks, @the-ress, I'll update the changelog & release notes. We probably need a way for folks to either disable expansion altogether or escape/ignore certain values. Do you have any suggestions on how this should work?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature 🎉 new commands, flags, functionality, and improved error messages triage issues and PRs that need to be triaged
Projects
None yet
Development

No branches or pull requests

6 participants