Skip to content

Commit e7b0fd2

Browse files
committed
sentry - routes - get config
1 parent 44c6437 commit e7b0fd2

File tree

4 files changed

+18
-4
lines changed

4 files changed

+18
-4
lines changed

sentry/src/application.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use adapter::client::Locked;
88
use axum::{
99
extract::{FromRequest, RequestParts},
1010
http::StatusCode,
11-
middleware, Extension, Router,
11+
middleware, Extension, Router, routing::get,
1212
};
1313
use hyper::{
1414
service::{make_service_fn, service_fn},
@@ -37,7 +37,7 @@ use crate::{
3737
routers::{
3838
analytics_router, campaigns_router, campaigns_router_axum, channels_router,
3939
channels_router_axum,
40-
},
40+
}, get_cfg_axum,
4141
},
4242
};
4343
use adapter::Adapter;
@@ -195,6 +195,7 @@ where
195195

196196
Router::new()
197197
.nest("/v5", router)
198+
.route("/cfg", get(get_cfg_axum::<C>))
198199
.layer(
199200
// keeps the order from top to bottom!
200201
ServiceBuilder::new()

sentry/src/routes.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -499,6 +499,7 @@
499499
pub use analytics::analytics as get_analytics;
500500

501501
pub use cfg::config as get_cfg;
502+
pub use cfg::config_axum as get_cfg_axum;
502503

503504
// `analytics` module has single request, so we only export this request
504505
mod analytics;

sentry/src/routes/campaign.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -791,6 +791,7 @@ pub mod insert_events {
791791
#[error("Campaign ran out of remaining budget to spend")]
792792
CampaignOutOfBudget,
793793
}
794+
794795
/// POST `/v5/campaign/:id/events`
795796
///
796797
/// Request body (json): [`InsertEventsRequest`]
@@ -1268,7 +1269,7 @@ mod test {
12681269
};
12691270

12701271
/// Test single campaign creation and modification
1271-
// &
1272+
/// &
12721273
/// Test with multiple campaigns (because of Budget) and modifications
12731274
#[tokio::test]
12741275
async fn create_and_modify_with_multiple_campaigns() {

sentry/src/routes/cfg.rs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,20 @@
11
//! `GET /cfg` request
22
3-
use crate::{response::ResponseError, Application};
43
use adapter::client::Locked;
4+
use axum::{Extension, Json};
55
use hyper::{header::CONTENT_TYPE, Body, Request, Response};
66

7+
use primitives::Config;
8+
9+
use crate::{response::ResponseError, Application};
10+
11+
/// `GET /cfg` request
12+
pub async fn config_axum<C: Locked + 'static>(
13+
Extension(app): Extension<Application<C>>,
14+
) -> Json<Config> {
15+
Json(app.config.clone())
16+
}
17+
718
/// `GET /cfg` request
819
pub async fn config<C: Locked + 'static>(
920
_: Request<Body>,

0 commit comments

Comments
 (0)