Skip to content
Closed
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
27 changes: 18 additions & 9 deletions packages/core/pegboard-serverless/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -242,17 +242,26 @@ async fn outbound_handler(
v.parse::<HeaderValue>().ok()?,
))
})
.chain(std::iter::once((
X_RIVETKIT_TOTAL_SLOTS,
HeaderValue::try_from(slots_per_runner)?,
)))
// Add token if auth is enabled
.chain(
ctx.config()
.auth
.as_ref()
.map(|auth| {
anyhow::Ok((
X_RIVET_TOKEN,
HeaderValue::try_from(auth.admin_token.read())?,
))
})
.transpose()?,
)
.collect();

let mut req = client
.get(url)
.headers(headers)
.header(X_RIVETKIT_TOTAL_SLOTS, slots_per_runner.to_string());

// Add admin token if configured
if let Some(auth) = &ctx.config().auth {
req = req.header(X_RIVET_TOKEN, auth.admin_token.read());
}
let mut req = client.get(url).headers(headers);

let mut source = sse::EventSource::new(req).context("failed creating event source")?;
let mut runner_id = None;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,11 @@ pub async fn namespace_resolve_for_name_global(
let client = client.clone();
async move {
let url = leader_dc.api_peer_url.join(&format!("/namespaces"))?;
let res = client.get(url).query(&[("name", &input.name)]).send().await?;
let res = client
.get(url)
.query(&[("name", &input.name)])
.send()
.await?;

let res = rivet_api_util::parse_response::<
rivet_api_types::namespaces::list::ListResponse,
Expand Down
Loading