Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/brown-ghosts-teach.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'hive-apollo-router-plugin': patch
---

Use the correct plugin version in the User-Agent header used for Console requests
6 changes: 3 additions & 3 deletions packages/libraries/router/src/agent.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
use crate::consts::PLUGIN_VERSION;

use super::graphql::OperationProcessor;
use graphql_parser::schema::{parse_schema, Document};
use reqwest::Client;
Expand All @@ -10,8 +12,6 @@ use std::{
use thiserror::Error;
use tokio::sync::Mutex as AsyncMutex;

static COMMIT: Option<&'static str> = option_env!("GITHUB_SHA");

#[derive(Serialize, Debug)]
pub struct Report {
size: usize,
Expand Down Expand Up @@ -299,7 +299,7 @@ impl UsageAgent {
)
.header(
reqwest::header::USER_AGENT,
format!("hive-apollo-router/{}", COMMIT.unwrap_or("local")),
format!("hive-apollo-router/{}", PLUGIN_VERSION),
)
.json(&report)
.send()
Expand Down
1 change: 1 addition & 0 deletions packages/libraries/router/src/consts.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pub const PLUGIN_VERSION: &str = env!("CARGO_PKG_VERSION");
1 change: 1 addition & 0 deletions packages/libraries/router/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
mod agent;
pub mod consts;
mod graphql;
pub mod persisted_documents;
pub mod registry;
Expand Down
1 change: 1 addition & 0 deletions packages/libraries/router/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// Specify the modules our binary should include -- https://twitter.com/YassinEldeeb7/status/1468680104243077128
mod agent;
mod consts;
mod graphql;
mod persisted_documents;
mod registry;
Expand Down
5 changes: 2 additions & 3 deletions packages/libraries/router/src/registry.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use crate::consts::PLUGIN_VERSION;
use crate::registry_logger::Logger;
use anyhow::{anyhow, Result};
use sha2::Digest;
Expand All @@ -24,8 +25,6 @@ pub struct HiveRegistryConfig {
schema_file_path: Option<String>,
}

static COMMIT: Option<&'static str> = option_env!("GITHUB_SHA");

impl HiveRegistry {
#[allow(clippy::new_ret_no_self)]
pub fn new(user_config: Option<HiveRegistryConfig>) -> Result<()> {
Expand Down Expand Up @@ -171,7 +170,7 @@ impl HiveRegistry {
headers.insert(
reqwest::header::USER_AGENT,
reqwest::header::HeaderValue::from_str(
format!("hive-apollo-router/{}", COMMIT.unwrap_or("local")).as_str(),
format!("hive-apollo-router/{}", PLUGIN_VERSION).as_str(),
)
.unwrap(),
);
Expand Down
Loading