File tree Expand file tree Collapse file tree 1 file changed +6
-4
lines changed
Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ use crate::{
55} ;
66use eyre:: Context ;
77use futures:: stream:: { SplitSink , SplitStream } ;
8+ use rbuilder_config:: EnvOrValue ;
89use serde:: Deserialize ;
910use tokio:: net:: TcpStream ;
1011use tokio_tungstenite:: {
@@ -19,7 +20,7 @@ pub struct TitanWsPublisherConfig {
1920 /// Be sure to use unique names. Maybe we can take it from the titan_url?
2021 pub relay_name : String ,
2122 /// used as header X-Api-Token, for use with titan builder direct endpoint
22- pub api_token : String ,
23+ pub api_token : EnvOrValue < String > ,
2324}
2425
2526pub struct TitanWsConnectionHandler {
@@ -39,9 +40,10 @@ impl ConnectionHandler for TitanWsConnectionHandler {
3940 }
4041 fn configure_request ( & self , request : & mut Request < ( ) > ) -> eyre:: Result < ( ) > {
4142 let headers = request. headers_mut ( ) ;
42- let api_token_header_value =
43- tokio_tungstenite:: tungstenite:: http:: HeaderValue :: from_str ( & self . cfg . api_token )
44- . wrap_err ( "Invalid header value for 'X-Api-Token'" ) ?;
43+ let api_token_header_value = tokio_tungstenite:: tungstenite:: http:: HeaderValue :: from_str (
44+ & self . cfg . api_token . value ( ) ?,
45+ )
46+ . wrap_err ( "Invalid header value for 'X-Api-Token'" ) ?;
4547 headers. insert ( "X-Api-Token" , api_token_header_value) ;
4648 Ok ( ( ) )
4749 }
You can’t perform that action at this time.
0 commit comments