-
Notifications
You must be signed in to change notification settings - Fork 0
feat(flags): Basic flags service #31
Changes from 1 commit
aad0f2c
b5591f5
b3308d3
27e69e9
68fe2bb
877e4df
b5c4ebf
777788f
15a43e2
1c3481f
3f3241e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,9 +21,7 @@ pub fn router<R: Client + Send + Sync + 'static>(redis: Arc<R>) -> Router { | |
// .allow_credentials(true) | ||
// .allow_origin(AllowOrigin::mirror_request()); | ||
|
||
let router = Router::new() | ||
Router::new() | ||
.route("/flags", post(v0_endpoint::flags).get(v0_endpoint::flags)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. you'll need to wire readiness, liveness and metrics too. Can be done later. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Indeed. Added to list here: PostHog/posthog#22131 |
||
.with_state(state); | ||
|
||
router | ||
.with_state(state) | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,7 +28,7 @@ pub struct ServerHandle { | |
|
||
impl ServerHandle { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I tried not re-building this and just using axum-test, but ran into annoyances there around the IP extraction not working well, what capture does sans axum-test-helper indeed seems the most flexible + useful here 👍 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I meant this one: https://docs.rs/axum-test/latest/axum_test/ but indeed control over all the boilerplate here, given its not a lot is 👍 |
||
pub async fn for_config(config: Config) -> ServerHandle { | ||
let listener = TcpListener::bind("127.0.0.1:0").await.unwrap(); | ||
let listener = TcpListener::bind("127.0.0.1:3001").await.unwrap(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Port zero is intentional, it tells the OS to assign a random port that's available, avoiding collision with other processes and other tests in parallel. That's why we then call There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. whoops, great catch, thanks! I was trying something here, forgot to revert 🤦 |
||
let addr = listener.local_addr().unwrap(); | ||
let notify = Arc::new(Notify::new()); | ||
let shutdown = notify.clone(); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
endpoint name tbd