Skip to content

Commit

Permalink
feat(install): plugins support APOLLO_ROVER_DOWNLOAD_HOST (#1713)
Browse files Browse the repository at this point in the history
Co-authored-by: Avery Harnish <[email protected]>
Co-authored-by: Avery Harnish <[email protected]>
  • Loading branch information
3 people authored Aug 18, 2023
1 parent 7ce2ef5 commit 0d37eb3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions docs/source/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ Rover is distributed on npm for integration with your JavaScript projects.
Internally, the `npm` installer downloads router binaries from `https://rover.apollo.dev`. If this URL is unavailable, for example, in a private network, you can point the `npm` installer at another URL in one of two ways:

- by setting the `APOLLO_ROVER_DOWNLOAD_HOST` environment variable
- *note*: This value must be set if you also want the rover plugins to be downloaded from this host
- by adding the following to your global or local `.npmrc`:

```ini
Expand Down
8 changes: 7 additions & 1 deletion src/command/install/plugin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,12 +92,18 @@ impl Plugin {

pub fn get_tarball_url(&self) -> RoverResult<String> {
Ok(format!(
"https://rover.apollo.dev/tar/{name}/{target_arch}/{version}",
"{host}/tar/{name}/{target_arch}/{version}",
host = self.get_host(),
name = self.get_name(),
target_arch = self.get_target_arch()?,
version = self.get_tarball_version()
))
}

fn get_host(&self) -> String {
std::env::var("APOLLO_ROVER_DOWNLOAD_HOST")
.unwrap_or_else(|_| "https://rover.apollo.dev".to_string())
}
}

impl FromStr for Plugin {
Expand Down

0 comments on commit 0d37eb3

Please sign in to comment.