Skip to content

Commit 2dc425d

Browse files
committed
chore: Add PACT_ prefix to all V2 engine env vars
1 parent 0c8187d commit 2dc425d

4 files changed

Lines changed: 16 additions & 16 deletions

File tree

.github/workflows/build.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ jobs:
5151
env:
5252
RUST_LOG: debug
5353
RUST_BACKTRACE: 1
54-
MATCHING_ENGINE: v2
55-
V2_MATCHING_LOG_EXECUTED_PLAN: 1
54+
PACT_MATCHING_ENGINE: v2
55+
PACT_V2_MATCHING_LOG_EXECUTED_PLAN: 1
5656

5757
musl-build:
5858
runs-on: ubuntu-latest

rust/pact_matching/README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -645,13 +645,13 @@ WS : [ \t\n\r] + -> skip ;
645645

646646
## V2 matching engine
647647

648-
Version 2.0+ has a redesigned matching engine. To enable it, set the `MATCHING_ENGINE` environment variable to `v2`.
648+
Version 2.0+ has a redesigned matching engine. To enable it, set the `PACT_MATCHING_ENGINE` environment variable to `v2`.
649649

650-
The machine engine now has two phases. The first phase builds a matching plan from the expected interaction as an
651-
abstract syntax tree (AST), and then the second phase executes the AST against the actual request or response.
650+
The machine engine now has two phases. The first phase builds a matching plan from the expected interaction as a
651+
tree (AST), and then the second phase executes the AST against the actual request or response.
652652

653653
The following environment variables control the matching:
654-
* `MATCHING_ENGINE` - Engine to use: `v1` or `v2`.
655-
* `V2_MATCHING_COLOURED_OUTPUT` - Enables coloured output with the V2 engine.
656-
* `V2_MATCHING_LOG_PLAN_SUMMARY` - Displays a summary of the executed plan. Enabled by default.
657-
* `V2_MATCHING_LOG_EXECUTED_PLAN` - Logs the executed plan details (AST).
654+
* `PACT_MATCHING_ENGINE` - Engine to use: `v1` or `v2`.
655+
* `PACT_V2_MATCHING_COLOURED_OUTPUT` - Enables coloured output with the V2 engine.
656+
* `PACT_V2_MATCHING_LOG_PLAN_SUMMARY` - Displays a summary of the executed plan. Enabled by default.
657+
* `PACT_V2_MATCHING_LOG_EXECUTED_PLAN` - Logs the executed plan details (AST).

rust/pact_matching/src/engine/context.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,19 +24,19 @@ pub struct MatchingConfiguration {
2424

2525
impl MatchingConfiguration {
2626
/// Configures the matching engine configuration from environment variables:
27-
/// * `V2_MATCHING_LOG_EXECUTED_PLAN` - Enable to log the executed plan.
28-
/// * `V2_MATCHING_LOG_PLAN_SUMMARY` - Enable to log a summary of the executed plan.
29-
/// * `V2_MATCHING_COLOURED_OUTPUT` - Enables coloured output.
27+
/// * `PACT_V2_MATCHING_LOG_EXECUTED_PLAN` - Enable to log the executed plan.
28+
/// * `PACT_V2_MATCHING_LOG_PLAN_SUMMARY` - Enable to log a summary of the executed plan.
29+
/// * `PACT_V2_MATCHING_COLOURED_OUTPUT` - Enables coloured output.
3030
pub fn init_from_env() -> Self {
3131
let mut config = MatchingConfiguration::default();
3232

33-
if let Some(val) = env_var_set("V2_MATCHING_LOG_EXECUTED_PLAN") {
33+
if let Some(val) = env_var_set("PACT_V2_MATCHING_LOG_EXECUTED_PLAN") {
3434
config.log_executed_plan = val;
3535
}
36-
if let Some(val) = env_var_set("V2_MATCHING_LOG_PLAN_SUMMARY") {
36+
if let Some(val) = env_var_set("PACT_V2_MATCHING_LOG_PLAN_SUMMARY") {
3737
config.log_plan_summary = val;
3838
}
39-
if let Some(val) = env_var_set("V2_MATCHING_COLOURED_OUTPUT") {
39+
if let Some(val) = env_var_set("PACT_V2_MATCHING_COLOURED_OUTPUT") {
4040
config.coloured_output = val;
4141
}
4242

rust/pact_matching/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1884,7 +1884,7 @@ pub async fn match_request<'a>(
18841884
};
18851885
trace!("plugin_data = {:?}", plugin_data);
18861886

1887-
let use_v2_engine = std::env::var("MATCHING_ENGINE")
1887+
let use_v2_engine = std::env::var("PACT_MATCHING_ENGINE")
18881888
.map(|val| val.to_lowercase() == "v2")
18891889
.unwrap_or(false);
18901890
if use_v2_engine {

0 commit comments

Comments
 (0)