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

Allow Router Configuration from Rover Dev #1373

Closed
blackie6091 opened this issue Oct 10, 2022 · 7 comments · Fixed by #1446 or #1486
Closed

Allow Router Configuration from Rover Dev #1373

blackie6091 opened this issue Oct 10, 2022 · 7 comments · Fixed by #1446 or #1486
Assignees
Labels
feature 🎉 new commands, flags, functionality, and improved error messages triage issues and PRs that need to be triaged
Milestone

Comments

@blackie6091
Copy link

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.

@blackie6091 blackie6091 added feature 🎉 new commands, flags, functionality, and improved error messages triage issues and PRs that need to be triaged labels Oct 10, 2022
@cristian-pelegrin
Copy link

totally agree!!

@nburnett-mw
Copy link

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
Copy link

heddendorp commented Dec 4, 2022

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
Copy link

+1 for header propagation in rover dev, watching!

@EverlastingBugstopper EverlastingBugstopper added this to the vNext milestone Dec 15, 2022
@EverlastingBugstopper EverlastingBugstopper self-assigned this Dec 15, 2022
@EverlastingBugstopper
Copy link
Contributor

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

@Ignigena
Copy link

Ignigena commented Dec 20, 2022

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

@rkostrzewski
Copy link

@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 😍

EverlastingBugstopper added a commit that referenced this issue Jan 24, 2023
# [0.11.0] - 2023-01-24

## 🚀 Features

- **Manage contract configuration - @sachindshinde, #1475 fixes #1421**
 
Rover now includes two commands for creating, modifying, and reading
contracts: `rover contract publish` and `rover contract describe`.
Further documentation can be found
[here](https://www.apollographql.com/docs/rover/commands/contracts).

- **Easier file output with new `--output` argument - @gocamille, #1413
fixes #1212**

The `--output` argument has long been used to configure the format of
Rover's output. i.e. `--output json` configures Rover to print its
output as a JSON object. This argument has been _renamed_ to `--format`
while maintaining backwards compatibility. `--format json` should be
used to configure the format of Rover's output, and the `--output`
argument allows you to specify a file to print the output to. Adding
`--output schema.graphql` to a `rover subgraph fetch` command will
output your schema to a file. `--output data.json --format json` will
output the command data to `data.json`. `--output json` will still work
by itself but will now print a warning, and `--output [json|plain]` does
not work with `--format [json|plain]`. Further documentation can be
found
[here](https://www.apollographql.com/docs/rover/conventions#output-to-a-file).

- **Adds `--router-config` to `rover dev` - @EverlastingBugstopper,
#1446 fixes #1373, #1345, and #1468**

The new `--router-config` argument for `rover dev` allows you to pass a
[router configuration file]() on startup that can configure settings
such as header propagaion and CORS policies. Further documentation can
be found
[here](https://www.apollographql.com/docs/rover/commands/dev/#advanced-configuration).

- **Auto-update router versions in `rover dev` - @EverlastingBugstopper,
#1432**

`rover dev` will automatically use the version of the router specified
in [this plugin
file](https://github.com/apollographql/rover/blob/main/latest_plugin_versions.json)
instead of a hard coded version.

## 🛠 Maintenance

- **Better error and help text for ELv2 license argument - @DoumanAsh,
#1456 fixes #1455**

The help text for the `--elv2-license` argument now includes the
expected value for the argument, in addition to the error message
returned when the argument is needed but not passed.

- **Updates the Ariadne template URL - @patrick91, #1439**

- **Updates `./examples/supergraph-demo` to `@apollo/server` v4, and
removes `./examples/dev` - @EverlastingBugsttopper, #1442 fixes #1440
and #1441**

- **Updates dependencies - @EverlastingBugstopper, #1481, #1450**

  `apollo-parser` 0.3 -> 0.4
  `base64` 0.13 -> 0.21
  `git2` 0.15 -> 0.16
  `graphql_client` 0.11.0 -> 0.12
  `serial_test` 0.9 -> 1.0
  `os_info` 3.4 -> 3.5
  `os_type` 2.4 -> 2.6
  `termcolor` 1.1 -> 1.2
  `tokio` 1.21 -> 1.24

## 📚 Documentation

- **Fixes a link to schema check example - @MayCXC, #1431**
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
8 participants