Skip to content
This repository has been archived by the owner on Jul 26, 2024. It is now read-only.

refactor: Replace location determination with common-rs crate #219

Merged
merged 4 commits into from
Aug 16, 2021

Conversation

mythmon
Copy link
Contributor

@mythmon mythmon commented Jul 21, 2021

Description

The location parsing code that Contile had was useful, so I stole it to put into mozilla-services/common-rs#14. This PR re-integrates that code as an external crate. Note that this is currently pulling the crate straight from that PR. That means the other PR should merge and this PR should be updated to point to crates.io before we merge this PR.

This drops support for GCS provided location headers, which are not being used currently. We should consider adding that feature to the shared crate as well.

Testing

MaxMind based location should work exactly the same as before. Non-location features should be unaffected.

@mythmon mythmon requested a review from a team July 21, 2021 22:58
Copy link
Member

@pjenvey pjenvey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs a small update for the latest main

@@ -17,7 +21,7 @@ use crate::{

pub mod cache;
pub mod img_storage;
pub mod location;
// pub mod location;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

kill

tags::Tags,
web::{middleware::sentry as l_sentry, DeviceInfo},
};
use actix_web_location::Location;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: should go up top under the actix_web import

src/web/test.rs Outdated

/// customizing the settings
fn get_test_settings() -> Settings {
let treq = test::TestRequest::with_uri("/").to_http_request();
Settings {
maxminddb_loc: Some(MMDB_LOC.to_owned()),
maxminddb_loc: Some(PathBuf::from(MMDB_LOC)),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: could just into this, avoiding the PathBuf import

Suggested change
maxminddb_loc: Some(PathBuf::from(MMDB_LOC)),
maxminddb_loc: Some(MMDB_LOC.into()),

mythmon added 3 commits July 30, 2021 10:56
This drops support for GCS provided location headers, which are not being used
currently. We should consider adding that feature to the shared crate as well.
@mythmon mythmon marked this pull request as ready for review August 2, 2021 16:15
@mythmon mythmon requested a review from pjenvey August 2, 2021 16:17
pjenvey
pjenvey previously approved these changes Aug 16, 2021
Copy link
Member

@pjenvey pjenvey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry @mythmon I totally missed the last update.

I've fixed the merge conflicts here: https://github.com/mozilla-services/contile/tree/extract-location-merge

Shall I push that merge to your branch?

@mythmon
Copy link
Contributor Author

mythmon commented Aug 16, 2021

Yes please. Thanks for doing the merge again.

@jrconlin jrconlin merged commit ac2783c into main Aug 16, 2021
@jrconlin jrconlin deleted the extract-location branch August 16, 2021 21:50
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants