Skip to content

Commit 74547e2

Browse files
committed
Merge branch 'main' into feature/didomi-integration
2 parents 1147156 + 68eb929 commit 74547e2

File tree

18 files changed

+3088
-208
lines changed

18 files changed

+3088
-208
lines changed

Cargo.lock

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ log = "0.4.28"
4040
log-fastly = "0.11.12"
4141
lol_html = "2.7.0"
4242
once_cell = "1.21"
43+
matchit = "0.9"
4344
pin-project-lite = "0.2"
4445
rand = "0.8"
4546
regex = "1.12.2"

crates/common/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ log = { workspace = true }
3131
rand = { workspace = true }
3232
log-fastly = { workspace = true }
3333
lol_html = { workspace = true }
34+
matchit = { workspace = true }
3435
pin-project-lite = { workspace = true }
3536
regex = { workspace = true }
3637
serde = { workspace = true }

crates/common/src/backend.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ pub fn ensure_origin_backend(
7474
}
7575
}
7676
}
77+
7778
pub fn ensure_backend_from_url(origin_url: &str) -> Result<String, Report<TrustedServerError>> {
7879
let parsed_url = Url::parse(origin_url).change_context(TrustedServerError::Proxy {
7980
message: format!("Invalid origin_url: {}", origin_url),

crates/common/src/integrations/didomi.rs

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ use crate::integrations::{IntegrationEndpoint, IntegrationProxy, IntegrationRegi
1414
use crate::settings::{IntegrationConfig, Settings};
1515

1616
const DIDOMI_INTEGRATION_ID: &str = "didomi";
17-
const DIDOMI_PREFIX: &str = "/didomi/consent";
17+
const DIDOMI_PREFIX: &str = "/integrations/didomi/consent";
1818

1919
/// Configuration for the Didomi consent notice reverse proxy.
2020
#[derive(Debug, Clone, Deserialize, Serialize, Validate)]
@@ -178,11 +178,12 @@ pub fn register(settings: &Settings) -> Option<IntegrationRegistration> {
178178

179179
#[async_trait(?Send)]
180180
impl IntegrationProxy for DidomiIntegration {
181+
fn integration_name(&self) -> &'static str {
182+
DIDOMI_INTEGRATION_ID
183+
}
184+
181185
fn routes(&self) -> Vec<IntegrationEndpoint> {
182-
vec![
183-
IntegrationEndpoint::get_prefix(DIDOMI_PREFIX),
184-
IntegrationEndpoint::post_prefix(DIDOMI_PREFIX),
185-
]
186+
vec![self.get("/consent/*"), self.post("/consent/*")]
186187
}
187188

188189
async fn handle(
@@ -272,8 +273,8 @@ mod tests {
272273
.expect("should insert config");
273274

274275
let registry = IntegrationRegistry::new(&settings);
275-
assert!(registry.has_route(&Method::GET, "/didomi/consent/loader.js"));
276-
assert!(registry.has_route(&Method::POST, "/didomi/consent/api/events"));
276+
assert!(registry.has_route(&Method::GET, "/integrations/didomi/consent/loader.js"));
277+
assert!(registry.has_route(&Method::POST, "/integrations/didomi/consent/api/events"));
277278
assert!(!registry.has_route(&Method::GET, "/other"));
278279
}
279280
}

0 commit comments

Comments
 (0)