Skip to content

Commit

Permalink
fix: instrument config fields & auth
Browse files Browse the repository at this point in the history
  • Loading branch information
XOR-op committed Nov 29, 2024
1 parent 8796032 commit f35fece
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion boltconn/src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,7 @@ async fn initialize_dns(

fn start_instrument_services(bus: Arc<MessageBus>, config: Option<&RawInstrumentConfig>) {
if let Some(config) = config {
let web_server = InstrumentServer::new(config.api_key.clone(), bus.clone());
let web_server = InstrumentServer::new(config.secret.clone(), bus.clone());
let addr = config.api_addr.as_socket_addr(default_inbound_ip_addr);
let cors_allowed_list = config.cors_allowed_list.clone();
tokio::spawn(async move { web_server.run(addr, cors_allowed_list.as_slice()).await });
Expand Down
4 changes: 2 additions & 2 deletions boltconn/src/config/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,11 +98,11 @@ pub struct RawWebControllerConfig {
}

#[derive(Serialize, Deserialize, Debug, Clone)]
#[serde(deny_unknown_fields)]
pub struct RawInstrumentConfig {
#[serde(alias = "api-port", alias = "api-addr")]
pub api_addr: PortOrSocketAddr,
#[serde(alias = "api-key")]
pub api_key: Option<String>,
pub secret: Option<String>,
#[serde(alias = "cors-allowed-list", default = "default_str_vec")]
pub cors_allowed_list: Vec<String>,
}
Expand Down
2 changes: 1 addition & 1 deletion boltconn/src/external/instrument_server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ impl InstrumentServer {
listen_addr: SocketAddr,
cors_allowed_list: &[String],
) -> Result<(), RuntimeError> {
let secret = Arc::new(self.secret.clone());
let secret = Arc::new(None); // We verify the secret in the subscribe parameters
let cors_vec = parse_cors_allow(cors_allowed_list);
let auth_wrapper = move |r| web_auth(secret.clone(), r, cors_vec.clone());

Expand Down

0 comments on commit f35fece

Please sign in to comment.