Skip to content

Commit

Permalink
feat(install): plugins support APOLLO_ROVER_DOWNLOAD_HOST
Browse files Browse the repository at this point in the history
Co-authored-by: Avery Harnish <[email protected]>
  • Loading branch information
LongLiveCHIEF and EverlastingBugstopper committed Aug 17, 2023
1 parent 26ab19b commit 1f13d35
Show file tree
Hide file tree
Showing 2 changed files with 7 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
7 changes: 6 additions & 1 deletion src/command/install/plugin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,12 +92,17 @@ 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 1f13d35

Please sign in to comment.