File tree Expand file tree Collapse file tree 1 file changed +11
-13
lines changed
packages/core/pegboard-serverless/src Expand file tree Collapse file tree 1 file changed +11
-13
lines changed Original file line number Diff line number Diff line change @@ -234,6 +234,16 @@ async fn outbound_handler(
234234 draining : Arc < AtomicBool > ,
235235) -> Result < ( ) > {
236236 let client = rivet_pools:: reqwest:: client_no_timeout ( ) . await ?;
237+
238+ let token = if let Some ( auth) = & ctx. config ( ) . auth {
239+ Some ( (
240+ X_RIVET_TOKEN ,
241+ HeaderValue :: try_from ( auth. admin_token . read ( ) ) ?,
242+ ) )
243+ } else {
244+ None
245+ } ;
246+
237247 let headers = headers
238248 . into_iter ( )
239249 . flat_map ( |( k, v) | {
@@ -247,19 +257,7 @@ async fn outbound_handler(
247257 X_RIVETKIT_TOTAL_SLOTS ,
248258 HeaderValue :: try_from ( slots_per_runner) ?,
249259 ) ) )
250- // Add token if auth is enabled
251- . chain (
252- ctx. config ( )
253- . auth
254- . as_ref ( )
255- . map ( |auth| {
256- anyhow:: Ok ( (
257- X_RIVET_TOKEN ,
258- HeaderValue :: try_from ( auth. admin_token . read ( ) ) ?,
259- ) )
260- } )
261- . transpose ( ) ?,
262- )
260+ . chain ( token)
263261 . collect ( ) ;
264262
265263 let mut req = client. get ( url) . headers ( headers) ;
You can’t perform that action at this time.
0 commit comments