apollographql / rover

The CLI for Apollo GraphOS
https://rover.apollo.dev
Other
408 stars 85 forks source link

Allow Router Configuration from Rover Dev #1373

Closed blackie6091 closed 1 year ago

blackie6091 commented 2 years ago

Description

It'd be ideal to be able to configure additional properties on the router using the rover dev command. While our needs specifically pertain to header customizations, I could see other properties being made available as well. Our subgraphs require certain headers to always be present or an error will be thrown. Currently this makes the rover dev command unusable for our application. However, if something were enabled in the dev command to accept additional flags (e.g. --header propagate:authorization --header remove:cookie), we'd be able to spin up a more customized router using the rover dev command.

cristian-pelegrin commented 2 years ago

totally agree!!

nburnett-mw commented 2 years ago

This would be great for our use case as well!

I know zero rust but I took a stab at adding support and would happy to push up what I have that seems to work adding a custom header when running rover dev

heddendorp commented 1 year ago

Found this issues as I got super stuck with trying to develop both my client and server locally. Something that just sets

        cors:
          allow_any_origin: true
        headers:
          all:
            request:
              - propagate:
                  matching: .*

Would be desperately needed in development. Currently the local development is impossible for me as I need auth headers and with using GraphOS, the frontend will not share a host with the graph anyways. Currently I can either not use rover or search for the router command line arguments after it was launched, just to add these lines which will then work fine.

I feel like either my local setup is just entirely backwards or rover is largely useless for development. If there are tricks to handle these things without updating rover but by changing the local environment I'd be open to hear about them.

EDIT: I saw your branch @EverlastingBugstopper and if you could push that to npm somehow just under a preview tag I would be very grateful. Better to have something that is probably not great than to have nothing at all. I will also happily deal with any breaking changes to get this earlier. Building myself is not an option as I want to share the project with others. My current project is https://github.com/heddendorp/esn where I try to develop multiple subgraphs in one repo. This is mainly due to the shared services that will be needed and since my usecase is not actually a big company with distributed teams but rather a small project that I hope becomes mor accessible by splitting it up a little.

EDIT 2: I was considering using the router but then I think I am missing out on the schema updates. Even in Odyssey the process is pretty weird and does not lend itself to a quick setup for developers.

sshevlyagin commented 1 year ago

+1 for header propagation in rover dev, watching!

EverlastingBugstopper commented 1 year ago

A pre-release including this was just released today. Check out the release and notes here.

Ignigena commented 1 year ago

@EverlastingBugstopper Superb! Really looking forward to trying this out for local testing of header propogation.

rkostrzewski commented 1 year ago

@EverlastingBugstopper just tested it out and it seems like any configuration options apart from supergraph.listen are not preserved in the configuration file that's passed to router. Changing this part of code to copy the contents of the source config file to the tmp directory resulted in the headers being propagated 😍