Skip to content

Commit

Permalink
s/.com/.workers.dev
Browse files Browse the repository at this point in the history
  • Loading branch information
EverlastingBugstopper committed Feb 5, 2021
1 parent 1fd5582 commit d5fa2b0
Show file tree
Hide file tree
Showing 6 changed files with 314 additions and 21 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions crates/sputnik/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ serde_json = "1.0"
sha2 = "0.9"
structopt = "0.3"
thiserror = "1.0"
tracing = "0.1"
url = "2.2"
uuid = { version = "0.8", features = ["serde", "v4"] }

Expand Down
4 changes: 3 additions & 1 deletion crates/sputnik/src/session.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,10 @@ impl Session {
// set timeout to 400 ms to prevent blocking for too long on reporting
let timeout = Duration::from_millis(4000);
let body = serde_json::to_string(&self)?;
tracing::debug!("POSTing to {}", &self.reporting_info.endpoint);
tracing::debug!("{}", body);
reqwest::blocking::Client::new()
.post(self.reporting_info.endpoint.to_owned())
.post(self.reporting_info.endpoint.clone())
.body(body)
.header("User-Agent", &self.reporting_info.user_agent)
.header("Content-Type", "application/json")
Expand Down
304 changes: 300 additions & 4 deletions installers/npm/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion installers/npm/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"description": "The new Apollo CLI",
"main": "index.js",
"bin": {
"rover": "./run.js"
"rover": "run.js"
},
"scripts": {
"postinstall": "node ./install.js",
Expand Down
23 changes: 8 additions & 15 deletions src/telemetry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ use sputnik::{Command, Report, SputnikError};

use std::collections::HashMap;

const DEV_TELEMETRY_URL: &str = "http://localhost:8787/telemetry";
const PROD_TELEMETRY_URL: &str = "https://install.apollographql.com/telemetry";
const TELEMETRY_URL: &str = "https://install.apollographql.workers.dev/telemetry";

fn get_command_from_args(mut raw_arguments: &mut serde_json::Value) -> Command {
let mut commands = Vec::new();
Expand Down Expand Up @@ -89,25 +88,19 @@ impl Report for Rover {
}

fn endpoint(&self) -> Result<Url, SputnikError> {
if let Some(url) = self.env_store.get(RoverEnvKey::TelemetryUrl)? {
Ok(Url::parse(&url)?)
} else if cfg!(debug_assertions) {
Ok(DEV_TELEMETRY_URL.parse()?)
} else {
Ok(PROD_TELEMETRY_URL.parse()?)
}
let url = self
.env_store
.get(RoverEnvKey::TelemetryUrl)?
.unwrap_or_else(|| TELEMETRY_URL.to_string());
Ok(Url::parse(&url)?)
}

fn tool_name(&self) -> String {
option_env!("CARGO_PKG_NAME")
.unwrap_or("unknown")
.to_string()
env!("CARGO_PKG_NAME").to_string()
}

fn version(&self) -> String {
option_env!("CARGO_PKG_VERSION")
.unwrap_or("unknown")
.to_string()
env!("CARGO_PKG_VERSION").to_string()
}

fn machine_id_config(&self) -> Result<PathBuf, SputnikError> {
Expand Down

0 comments on commit d5fa2b0

Please sign in to comment.