Skip to content

Commit 4190f96

Browse files
committed
fix: modify querier_{endpoint, auth_token} to Option
1 parent 4357c93 commit 4190f96

File tree

2 files changed

+18
-14
lines changed

2 files changed

+18
-14
lines changed

server/src/handlers/http/cluster/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -849,8 +849,8 @@ pub async fn forward_create_stream_request(stream_name: &str) -> Result<(), Stre
849849
let staging_metadata = get_staging_metadata().unwrap().ok_or_else(|| {
850850
StreamError::Anyhow(anyhow::anyhow!("Failed to retrieve staging metadata"))
851851
})?;
852-
let querier_endpoint = to_url_string(staging_metadata.querier_endpoint);
853-
let token = staging_metadata.querier_auth_token;
852+
let querier_endpoint = to_url_string(staging_metadata.querier_endpoint.unwrap());
853+
let token = staging_metadata.querier_auth_token.unwrap();
854854

855855
if !check_liveness(&querier_endpoint).await {
856856
log::warn!("Querier {} is not live", querier_endpoint);

server/src/storage/store_metadata.rs

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -64,23 +64,27 @@ pub struct StorageMetadata {
6464
pub roles: HashMap<String, Vec<DefaultPrivilege>>,
6565
#[serde(default)]
6666
pub default_role: Option<String>,
67-
pub querier_endpoint: String,
68-
pub querier_auth_token: String,
67+
pub querier_endpoint: Option<String>,
68+
pub querier_auth_token: Option<String>,
6969
}
7070

7171
impl StorageMetadata {
7272
pub fn new() -> Self {
73-
let querier_auth_token = format!(
74-
"Basic {}",
75-
base64::prelude::BASE64_STANDARD.encode(format!(
76-
"{}:{}",
77-
CONFIG.parseable.username, CONFIG.parseable.password
78-
))
79-
);
80-
8173
let (querier_endpoint, querier_auth_token) = match CONFIG.parseable.mode {
82-
Mode::All | Mode::Query => (CONFIG.parseable.address.clone(), querier_auth_token),
83-
Mode::Ingest => (String::default(), String::default()),
74+
Mode::All | Mode::Query => {
75+
let querier_auth_token = format!(
76+
"Basic {}",
77+
base64::prelude::BASE64_STANDARD.encode(format!(
78+
"{}:{}",
79+
CONFIG.parseable.username, CONFIG.parseable.password
80+
))
81+
);
82+
(
83+
Some(CONFIG.parseable.address.clone()),
84+
Some(querier_auth_token),
85+
)
86+
}
87+
Mode::Ingest => (None, None),
8488
};
8589

8690
Self {

0 commit comments

Comments
 (0)