pact_broker 2.81.0 → 2.82.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (143) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/test.yml +1 -1
  3. data/CHANGELOG.md +30 -0
  4. data/DEVELOPER_SETUP.md +1 -1
  5. data/README.md +7 -5
  6. data/config.ru +3 -28
  7. data/db/migrations/20210722_add_index_to_triggered_webhooks_webhook_uuid.rb +7 -0
  8. data/db/migrations/20210810_set_allow_contract_modification.rb +17 -0
  9. data/docs/CONFIGURATION.md +398 -0
  10. data/docs/configuration.yml +320 -0
  11. data/example/Gemfile +4 -4
  12. data/example/README.md +15 -22
  13. data/example/config.ru +1 -24
  14. data/example/config/pact_broker.yml +9 -0
  15. data/example/config/puma.rb +3 -0
  16. data/lib/db.rb +1 -1
  17. data/lib/pact_broker/api/authorization/resource_access_policy.rb +68 -0
  18. data/lib/pact_broker/api/authorization/resource_access_rules.rb +40 -0
  19. data/lib/pact_broker/api/decorators/deployed_version_decorator.rb +2 -0
  20. data/lib/pact_broker/api/decorators/released_version_decorator.rb +2 -0
  21. data/lib/pact_broker/api/middleware/basic_auth.rb +63 -0
  22. data/lib/pact_broker/api/resources/pact.rb +15 -6
  23. data/lib/pact_broker/api/resources/tag.rb +1 -14
  24. data/lib/pact_broker/app.rb +52 -30
  25. data/lib/pact_broker/config/basic_auth_configuration.rb +38 -0
  26. data/lib/pact_broker/config/load.rb +21 -10
  27. data/lib/pact_broker/config/runtime_configuration.rb +188 -0
  28. data/lib/pact_broker/config/runtime_configuration_coercion_methods.rb +41 -0
  29. data/lib/pact_broker/config/runtime_configuration_database_methods.rb +119 -0
  30. data/lib/pact_broker/config/runtime_configuration_logging_methods.rb +61 -0
  31. data/lib/pact_broker/configuration.rb +67 -131
  32. data/lib/pact_broker/contracts/notice.rb +4 -0
  33. data/lib/pact_broker/contracts/service.rb +4 -4
  34. data/lib/pact_broker/db/models.rb +3 -0
  35. data/lib/pact_broker/db/validate_encoding.rb +0 -4
  36. data/lib/pact_broker/deployments/deployed_version.rb +8 -2
  37. data/lib/pact_broker/deployments/deployed_version_service.rb +13 -6
  38. data/lib/pact_broker/deployments/environment.rb +1 -1
  39. data/lib/pact_broker/deployments/released_version.rb +8 -0
  40. data/lib/pact_broker/deployments/released_version_service.rb +12 -0
  41. data/lib/pact_broker/doc/views/provider-pacts-for-verification.markdown +4 -0
  42. data/lib/pact_broker/domain/pacticipant.rb +17 -13
  43. data/lib/pact_broker/domain/verification.rb +4 -22
  44. data/lib/pact_broker/domain/version.rb +9 -5
  45. data/lib/pact_broker/domain/webhook.rb +4 -0
  46. data/lib/pact_broker/error.rb +1 -0
  47. data/lib/pact_broker/errors.rb +1 -1
  48. data/lib/pact_broker/feature_toggle.rb +3 -5
  49. data/lib/pact_broker/hash_refinements.rb +0 -1
  50. data/lib/pact_broker/index/service.rb +4 -6
  51. data/lib/pact_broker/initializers/database_connection.rb +80 -0
  52. data/lib/pact_broker/integrations/integration.rb +5 -0
  53. data/lib/pact_broker/integrations/service.rb +4 -2
  54. data/lib/pact_broker/locale/en.yml +1 -0
  55. data/lib/pact_broker/logging.rb +2 -1
  56. data/lib/pact_broker/matrix/integration.rb +1 -1
  57. data/lib/pact_broker/matrix/parse_can_i_deploy_query.rb +2 -2
  58. data/lib/pact_broker/matrix/quick_row.rb +10 -0
  59. data/lib/pact_broker/matrix/repository.rb +64 -3
  60. data/lib/pact_broker/metrics/service.rb +16 -13
  61. data/lib/pact_broker/pacticipants/repository.rb +4 -0
  62. data/lib/pact_broker/pacticipants/service.rb +9 -1
  63. data/lib/pact_broker/pacts/pact_publication.rb +10 -13
  64. data/lib/pact_broker/pacts/pact_publication_dataset_module.rb +6 -1
  65. data/lib/pact_broker/pacts/pact_publication_selector_dataset_module.rb +1 -2
  66. data/lib/pact_broker/pacts/pact_version.rb +25 -11
  67. data/lib/pact_broker/pacts/pacts_for_verification_repository.rb +54 -77
  68. data/lib/pact_broker/pacts/selected_pact.rb +1 -1
  69. data/lib/pact_broker/pacts/selector.rb +15 -2
  70. data/lib/pact_broker/pacts/selectors.rb +4 -0
  71. data/lib/pact_broker/pacts/service.rb +4 -0
  72. data/lib/pact_broker/repositories/scopes.rb +12 -1
  73. data/lib/pact_broker/string_refinements.rb +6 -0
  74. data/lib/pact_broker/tags/service.rb +8 -1
  75. data/lib/pact_broker/test/http_test_data_builder.rb +11 -5
  76. data/lib/pact_broker/ui/views/index/_css_and_js.haml +11 -9
  77. data/lib/pact_broker/ui/views/index/_pagination.haml +3 -1
  78. data/lib/pact_broker/ui/views/layouts/main.haml +5 -3
  79. data/lib/pact_broker/ui/views/matrix/show.haml +10 -8
  80. data/lib/pact_broker/verifications/required_verification.rb +28 -0
  81. data/lib/pact_broker/verifications/service.rb +49 -1
  82. data/lib/pact_broker/version.rb +1 -1
  83. data/lib/pact_broker/versions/repository.rb +15 -0
  84. data/lib/pact_broker/versions/service.rb +32 -2
  85. data/lib/pact_broker/webhooks/event_listener.rb +3 -0
  86. data/lib/pact_broker/webhooks/trigger_service.rb +30 -14
  87. data/lib/pact_broker/webhooks/triggered_webhook.rb +1 -0
  88. data/lib/pact_broker/webhooks/webhook.rb +2 -2
  89. data/lib/pact_broker/webhooks/webhook_event.rb +6 -1
  90. data/lib/semantic_logger/formatters/short.rb +29 -0
  91. data/pact_broker.gemspec +1 -0
  92. data/script/data/auto-create-things-for-tags.rb +19 -0
  93. data/script/data/contract-published-requiring-verification.rb +27 -0
  94. data/script/{reproduce-issue-expand-currently-deployed.rb → data/expand-currently-deployed.rb} +0 -0
  95. data/script/docs/generate-configuration-docs.rb +86 -0
  96. data/spec/features/get_latest_pact_badge_spec.rb +1 -0
  97. data/spec/features/get_matrix_badge_spec.rb +1 -0
  98. data/spec/features/publish_pact_spec.rb +21 -7
  99. data/spec/features/wip_pacts_spec.rb +1 -1
  100. data/spec/fixtures/approvals/matrix_integration_environment_spec.approved.json +62 -0
  101. data/spec/fixtures/approvals/matrix_integration_ignore_spec.approved.json +124 -0
  102. data/spec/fixtures/approvals/matrix_integration_spec.approved.json +173 -0
  103. data/spec/fixtures/approvals/publish_contract_no_branch.approved.json +9 -9
  104. data/spec/fixtures/approvals/publish_contract_nothing_exists.approved.json +7 -7
  105. data/spec/fixtures/approvals/publish_contract_nothing_exists_with_webhook.approved.json +5 -5
  106. data/spec/fixtures/approvals/publish_contract_verification_already_exists.approved.json +5 -5
  107. data/spec/lib/pact_broker/api/middleware/basic_auth_spec.rb +312 -0
  108. data/spec/lib/pact_broker/api/resources/tag_spec.rb +14 -39
  109. data/spec/lib/pact_broker/app_basic_auth_spec.rb +122 -0
  110. data/spec/lib/pact_broker/config/load_spec.rb +33 -6
  111. data/spec/lib/pact_broker/config/runtime_configuration_logging_methods_spec.rb +22 -0
  112. data/spec/lib/pact_broker/config/runtime_configuration_spec.rb +71 -0
  113. data/spec/lib/pact_broker/configuration_spec.rb +51 -25
  114. data/spec/lib/pact_broker/errors/error_logger_spec.rb +3 -0
  115. data/spec/lib/pact_broker/feature_toggle_spec.rb +18 -19
  116. data/spec/lib/pact_broker/matrix/integration_environment_spec.rb +12 -0
  117. data/spec/lib/pact_broker/matrix/integration_ignore_spec.rb +15 -3
  118. data/spec/lib/pact_broker/matrix/integration_spec.rb +47 -6
  119. data/spec/lib/pact_broker/matrix/parse_can_i_deploy_query_spec.rb +16 -1
  120. data/spec/lib/pact_broker/matrix/repository_dependency_spec.rb +0 -2
  121. data/spec/lib/pact_broker/matrix/repository_spec.rb +0 -2
  122. data/spec/lib/pact_broker/metrics/service_spec.rb +44 -0
  123. data/spec/lib/pact_broker/pacticipants/service_spec.rb +28 -5
  124. data/spec/lib/pact_broker/pacts/pact_publication_selector_dataset_module_spec.rb +25 -0
  125. data/spec/lib/pact_broker/pacts/pact_version_spec.rb +30 -1
  126. data/spec/lib/pact_broker/pacts/repository_find_for_verification_spec.rb +107 -20
  127. data/spec/lib/pact_broker/pacts/verifiable_pact_messages_spec.rb +1 -1
  128. data/spec/lib/pact_broker/tags/service_spec.rb +24 -8
  129. data/spec/lib/pact_broker/verifications/service_spec.rb +146 -0
  130. data/spec/lib/pact_broker/versions/repository_spec.rb +38 -2
  131. data/spec/lib/pact_broker/versions/service_spec.rb +93 -2
  132. data/spec/lib/pact_broker/webhooks/trigger_service_spec.rb +54 -2
  133. data/spec/lib/rack/pact_broker/invalid_uri_protection_spec.rb +3 -3
  134. data/spec/spec_helper.rb +2 -1
  135. data/spec/support/approvals.rb +29 -0
  136. metadata +52 -13
  137. data/example/basic_auth/Gemfile +0 -5
  138. data/example/basic_auth/Procfile +0 -1
  139. data/example/basic_auth/README.md +0 -43
  140. data/example/basic_auth/config.ru +0 -19
  141. data/example/example_data.sql +0 -19
  142. data/spec/lib/pact_broker/config/save_and_load_spec.rb +0 -25
  143. data/spec/lib/pact_broker/pacts/service_find_for_verification_spec.rb +0 -50
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 264cb3fe694b76c1efc4ee585043f68957485f477ef60154357d72535741dc9e
4
- data.tar.gz: 2081f35b9a33d5e8ebe9817f5fda62b35378f437a66e69c2611555dc0f78228b
3
+ metadata.gz: 9a0cf4f6c970fd0fa0535eca1d44605e3e40d79407e6edf5e06f6ceea7160ece
4
+ data.tar.gz: bb6533b81dd28846a3ccda8d3fe2479c1621cd2117814ee63d5f6cf55f500079
5
5
  SHA512:
6
- metadata.gz: bf0de96a30b0893206130d39f9ae19d23eb411e81440d7a2099aa6dfe36cdb5ddd9d135f51d164f17b439d7a8db07ea060e5bc0a7e6b0a980e87b100f6e23cf1
7
- data.tar.gz: de1636fa911c024295c7b6d94df91219f7a7fe9a8ed3d838cbad635477b4623b220a0493181bac49652994bd19fb7a40f330a8a9bfc8efc25ceb20727c2653bd
6
+ metadata.gz: c5f7da8fe0a477ee49d54a3d2e034be142d3af6b7a942b47818e2809ae34c1d3add710ba316871d41001e4a1ec708769d51de176b37a47b4785b81778c729a0c
7
+ data.tar.gz: cd91ad22fb076907f240deb3322701f272b802839f2c1a6c3f44e232a452eb17fa5d5f61fe6ef0cfab3ac912d2b9700c5f33e30b918ba6bd1125735ace3af743
@@ -24,7 +24,7 @@ jobs:
24
24
  strategy:
25
25
  fail-fast: false
26
26
  matrix:
27
- ruby_version: ["2.5", "2.7"]
27
+ ruby_version: ["2.6", "2.7"]
28
28
  services:
29
29
  postgres:
30
30
  image: postgres
data/CHANGELOG.md CHANGED
@@ -1,3 +1,33 @@
1
+ <a name="v2.82.0"></a>
2
+ ### v2.82.0 (2021-08-14)
3
+
4
+ #### Features
5
+
6
+ * do not allow contract content for a consumer version to be modified for all new Broker instances (#484) ([b1819749](/../../commit/b1819749))
7
+ * ensure saved configuration is loaded appropriately into the RuntimeConfiguration ([c5ab52ad](/../../commit/c5ab52ad))
8
+ * automatically set main branch (#483) ([63e287ee](/../../commit/63e287ee))
9
+ * allow the first tag to be used as the branch name to assist migrating to branches (#478) ([a086214a](/../../commit/a086214a))
10
+ * add support for contract_requiring_verification_published webhook (#476) ([b4699df0](/../../commit/b4699df0))
11
+ * automatically create database connection from YAML or environment variable config ([ca34b030](/../../commit/ca34b030))
12
+ * move basic auth code in from pact-broker-docker ([869bcd61](/../../commit/869bcd61))
13
+ * allow Pact Broker to be configured using a YAML file and environment variables (#471) ([6e3d0e62](/../../commit/6e3d0e62))
14
+
15
+ * **pacts for verification**
16
+ * if no consumer version selectors are specified, return the pacts for the latest main version, and all the deployed and released versions ([5fccd524](/../../commit/5fccd524))
17
+
18
+ * **metrics**
19
+ * add counts for environment, deployed version, released version, pacticipants and versions with branch set ([8272b08b](/../../commit/8272b08b))
20
+
21
+ #### Bug Fixes
22
+
23
+ * lazy load latest verification using select max, and eager load using the skynet query ([e6ee6ab5](/../../commit/e6ee6ab5))
24
+ * improve performance of query for latest verification for pact_version ([d63081d8](/../../commit/d63081d8))
25
+ * do not allow the deployment of a provider version with no results when one of its consumers is already deployed (#486) ([219029c0](/../../commit/219029c0))
26
+ * add cache busting parameters to css and js links ([9cab749a](/../../commit/9cab749a))
27
+
28
+ * **can-i-deploy**
29
+ * correctly construct options when environment is used in the can-i-deploy GET endpoint ([cb79a404](/../../commit/cb79a404))
30
+
1
31
  <a name="v2.81.0"></a>
2
32
  ### v2.81.0 (2021-07-17)
3
33
 
data/DEVELOPER_SETUP.md CHANGED
@@ -125,7 +125,7 @@ To run:
125
125
  1. Load an exported real database into a postgres docker image. The exported file must be in the pg dump format to use this script, and it must be located in the project root directory for it to be found via the mounted directory.
126
126
 
127
127
  ```
128
- script/docker/reload.sh <export>
128
+ script/docker/restore.sh <export>
129
129
 
130
130
  ```
131
131
  1. Clear any previously generated approvals.
data/README.md CHANGED
@@ -3,13 +3,11 @@
3
3
  ![Build status](https://github.com/pact-foundation/pact_broker/workflows/Test/badge.svg)
4
4
  [![Join the chat at https://pact-foundation.slack.com/](https://img.shields.io/badge/chat-on%20slack-blue.svg?logo=slack)](https://slack.pact.io)
5
5
  [![security](https://hakiri.io/github/pact-foundation/pact_broker/master.svg)](https://hakiri.io/github/pact-foundation/pact_broker/master)
6
- [![Code Climate](https://codeclimate.com/github/pact-foundation/pact_broker/badges/gpa.svg)](https://codeclimate.com/github/pact-foundation/pact_broker)
7
- [![Test Coverage](https://codeclimate.com/github/pact-foundation/pact_broker/badges/coverage.svg)](https://codeclimate.com/github/pact-foundation/pact_broker/coverage)
8
6
 
9
7
  The Pact Broker is an application for sharing of consumer driven contracts and verification results. It is optimised for use with "pacts" (contracts created by the [Pact][pact-docs] framework), but can be used for any type of contract that can be serialized to JSON.
10
8
 
11
9
  <br/>
12
- <a href="https:/pactflow.io/?utm_source=github&utm_campaign=pact_broker_intro"><img src="docs/images/Pactflow logo - black small.png"></a>
10
+ <a href="https://pactflow.io/?utm_source=github&utm_campaign=pact_broker_intro"><img src="docs/images/Pactflow logo - black small.png"></a>
13
11
  <br/>
14
12
 
15
13
  You can try out a Pact Broker for free at <a href="https://pactflow.io/?utm_source=github&utm_campaign=pact_broker_intro"/>pactflow.io</a>. Built by a group of core Pact maintainers, Pactflow is a fork of the OSS Pact Broker with extra goodies like an improved UI, field level verification results and federated login.
@@ -160,13 +158,17 @@ You can use the [Pact Broker Docker image][docker] or [Terraform on AWS][terrafo
160
158
 
161
159
  Please read the [UPGRADING.md](UPGRADING.md) documentation before upgrading your Pact Broker, for information on the supported upgrade paths.
162
160
 
163
- [decouple]: http://techblog.realestate.com.au/enter-the-pact-matrix-or-how-to-decouple-the-release-cycles-of-your-microservices/
161
+ ## Versioning
162
+
163
+ The Pact Broker follows the [semantic versioning](https://semver.org/) scheme.
164
+
165
+ [decouple]: https://www.rea-group.com/blog/enter-the-pact-matrix-or-how-to-decouple-the-release-cycles-of-your-microservices/
164
166
  [pact]: https://github.com/pact-foundation/pact-ruby
165
167
  [nerf]: https://github.com/pact-foundation/pact_broker/wiki/pact-broker-ci-nerf-gun
166
168
  [different-teams]: https://github.com/pact-foundation/pact-ruby/wiki/Using-pact-where-the-consumer-team-is-different-from-the-provider-team
167
169
  [docker]: https://github.com/pact-foundation/pact-broker-docker
168
170
  [terraform]: https://github.com/nadnerb/terraform-pact-broker
169
- [pactflow]: https:/pactflow.io/?utm_source=github&utm_campaign=pact_broker_usage
171
+ [pactflow]: https://pactflow.io/?utm_source=github&utm_campaign=pact_broker_usage
170
172
  [wiki]: https://github.com/pact-foundation/pact_broker/wiki
171
173
  [reverse-proxy-docs]: https://github.com/pact-foundation/pact_broker/wiki/Configuration#running-the-broker-behind-a-reverse-proxy
172
174
  [stackoverflow]: http://stackoverflow.com/questions/tagged/pact-broker
data/config.ru CHANGED
@@ -1,36 +1,11 @@
1
- require "fileutils"
2
- require "logger"
3
- require "sequel"
4
1
  require "pact_broker"
5
2
 
6
- FileUtils.mkdir_p("tmp") unless ENV["PACT_BROKER_DATABASE_URL"]
7
-
8
- DATABASE_URL = ENV["PACT_BROKER_DATABASE_URL"] || "sqlite://tmp/pact_broker_database.sqlite3"
9
- DB_OPTIONS = { encoding: "utf8", sql_log_level: :debug }
10
-
11
3
  ENV["TZ"] = "Australia/Melbourne"
12
4
 
13
- SemanticLogger.add_appender(io: $stderr)
14
- SemanticLogger.default_level = :info
15
-
16
5
  app = PactBroker::App.new do | config |
17
- # config.logger.level = ::Logger::INFO
18
- config.auto_migrate_db = true
19
- config.enable_public_badge_access = true
20
- config.order_versions_by_date = true
21
- config.allow_missing_migration_files = true
22
- config.base_equality_only_on_content_that_affects_verification_results = true
23
- config.badge_provider_mode = :redirect
24
-
25
- config.webhook_retry_schedule = [3, 3, 3]
26
- config.webhook_host_whitelist = [/.*/, "10.0.0.0/8"]
27
- config.webhook_scheme_whitelist = ["http", "https"]
28
- config.webhook_http_method_whitelist = ["GET", "POST"]
29
- config.webhook_http_code_success = [200, 201, 202, 203, 204, 205, 206]
30
- config.base_url = ENV["PACT_BROKER_BASE_URL"]
31
-
32
- database_logger = PactBroker::DB::LogQuietener.new(config.logger)
33
- config.database_connection = Sequel.connect(DATABASE_URL, DB_OPTIONS.merge(logger: database_logger))
6
+ config.log_stream = :stdout
7
+ config.base_urls = ["http://localhost:9292"]
8
+ config.database_url = "sqlite:////tmp/pact_broker_database.sqlite3"
34
9
  end
35
10
 
36
11
  run app
@@ -0,0 +1,7 @@
1
+ Sequel.migration do
2
+ change do
3
+ alter_table(:triggered_webhooks) do
4
+ add_index([:webhook_uuid], name: "triggered_webhooks_webhook_uuid_index")
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,17 @@
1
+ Sequel.migration do
2
+ up do
3
+ if from(:pact_publications).count != 0
4
+ from(:config).insert(
5
+ name: "allow_dangerous_contract_modification",
6
+ type: "boolean",
7
+ value: "1",
8
+ created_at: Sequel.datetime_class.now,
9
+ updated_at: Sequel.datetime_class.now
10
+ )
11
+ end
12
+ end
13
+
14
+ down do
15
+
16
+ end
17
+ end
@@ -0,0 +1,398 @@
1
+ # Pact Broker Configuration
2
+
3
+
4
+ <br/>
5
+
6
+ ## Database
7
+
8
+ <hr/>
9
+
10
+
11
+ ### database_adapter
12
+
13
+ The database adapter. For production use, Postgres must be used.
14
+
15
+ For investigations/spikes on a development machine, you can use SQlite. It is not supported as a production database, as it does not support
16
+ concurrent requests.
17
+
18
+ **Default:** `postgres`<br/>
19
+ **Allowed values:** `postgres` (for production use), `sqlite` (for spikes only)<br/>
20
+
21
+ ### database_username
22
+
23
+ The database username
24
+
25
+
26
+ ### database_password
27
+
28
+ The database password
29
+
30
+
31
+ ### database_name
32
+
33
+ The database name. If using the `sqlite` adapter, this will be the path to the database file.
34
+
35
+ **Examples:** `pact_broker`, `/tmp/pact_broker.sqlite3`, `./tmp/pact_broker.sqlite3`<br/>
36
+
37
+ ### database_host
38
+
39
+ The database host
40
+
41
+
42
+ ### database_port
43
+
44
+ The database port. If ommited, the default port for the adapter will be used.
45
+
46
+
47
+ ### database_url
48
+
49
+ The full database URL may be specified instead of the separate adapter, username, password, name, host and port.
50
+
51
+ **Format:** {database_adapter}://{database_username}:{database_password}@{database_host}:{database_port}/{database_name}<br/>
52
+ **Examples:** `postgres://pact_broker_user:pact_broker_password@pact_broker_db_host/pact_broker`, `sqlite:////tmp/pact_broker.sqlite3`<br/>
53
+
54
+ ### database_sslmode
55
+
56
+ The Postgresql ssl mode.
57
+
58
+ **Default:** `prefer`<br/>
59
+ **Allowed values:** `disable`, `allow`, `prefer`, `require`, `verify-ca`, `verify-full`<br/>
60
+ **More information:** https://ankane.org/postgres-sslmode-explained<br/>
61
+
62
+ ### sql_log_level
63
+
64
+ The log level that will be used when the SQL query statements are logged.
65
+
66
+ To disable noisy SQL query logging when the application `log_level` is set to `debug` for other reasons, use the value `none`.
67
+
68
+ **Default:** `debug`<br/>
69
+ **Allowed values:** `none`, `debug`, `info`, `warn`, `error`, `fatal`<br/>
70
+
71
+ ### sql_log_warn_duration
72
+
73
+
74
+
75
+ **Default:** `5`<br/>
76
+
77
+ ### database_max_connections
78
+
79
+
80
+
81
+ **Default:** `nil`<br/>
82
+
83
+ ### database_pool_timeout
84
+
85
+
86
+
87
+ **Default:** `5`<br/>
88
+
89
+ ### database_connect_max_retries
90
+
91
+
92
+
93
+ **Default:** `0`<br/>
94
+
95
+ ### auto_migrate_db
96
+
97
+
98
+
99
+ **Default:** `true`<br/>
100
+
101
+ ### auto_migrate_db_data
102
+
103
+
104
+
105
+ **Default:** `true`<br/>
106
+
107
+ ### allow_missing_migration_files
108
+
109
+
110
+
111
+ **Default:** `true`<br/>
112
+
113
+ ### validate_database_connection_config
114
+
115
+
116
+
117
+ **Default:** `true`<br/>
118
+
119
+ ### database_statement_timeout
120
+
121
+
122
+
123
+ **Default:** `15`<br/>
124
+
125
+ ### metrics_sql_statement_timeout
126
+
127
+
128
+
129
+ **Default:** `30`<br/>
130
+
131
+ ### database_connection_validation_timeout
132
+
133
+
134
+
135
+
136
+ <br/>
137
+
138
+ ## Logging
139
+
140
+ <hr/>
141
+
142
+
143
+ ### log_level
144
+
145
+ The application log level
146
+
147
+ **Default:** `info`<br/>
148
+ **Allowed values:** `debug`, `info`, `warn`, `error`, `fatal`<br/>
149
+
150
+ ### log_format
151
+
152
+ The application log format. Can be any value supported by Semantic Logger.
153
+
154
+ **Default:** `default`<br/>
155
+ **Allowed values:** `default`, `json`, `color`<br/>
156
+ **More information:** https://github.com/rocketjob/semantic_logger/tree/master/lib/semantic_logger/formatters<br/>
157
+
158
+ ### log_dir
159
+
160
+ The log file directory
161
+
162
+ **Default:** `./logs`<br/>
163
+
164
+ ### log_stream
165
+
166
+ The stream to which the logs will be sent.
167
+
168
+ While the default is `file` for the Ruby application, it is set to `stdout` on the supported Docker images.
169
+
170
+ **Default:** `file`<br/>
171
+ **Allowed values:** `stdout`, `file`<br/>
172
+
173
+ ### hide_pactflow_messages
174
+
175
+ Set to `true` to hide the messages in the logs about Pactflow
176
+
177
+ **Default:** `true`<br/>
178
+ **Allowed values:** `true`, `false`<br/>
179
+ **More information:** https://pactflow.io<br/>
180
+
181
+ <br/>
182
+
183
+ ## Authentication and authorization
184
+
185
+ <hr/>
186
+ The Pact Broker comes with 2 configurable basic auth users - one with read/write privileges, and one with read only privileges.
187
+ The read only credentials should be distributed to the developers for use from development machines, and the read/write credentials
188
+ should be used for CI/CD.
189
+
190
+
191
+ ### basic_auth_enabled
192
+
193
+ Whether to enable basic authorization
194
+
195
+ **Default:** `false`<br/>
196
+ **Allowed values:** `true`, `false`<br/>
197
+
198
+ ### basic_auth_username
199
+
200
+ The username for the read/write basic auth user.
201
+
202
+
203
+ ### basic_auth_password
204
+
205
+ The password for the read/write basic auth user.
206
+
207
+
208
+ ### basic_auth_read_only_username
209
+
210
+ The username for the read only basic auth user.
211
+
212
+
213
+ ### basic_auth_read_only_password
214
+
215
+ The password for the read only basic auth user.
216
+
217
+
218
+ ### allow_public_read
219
+
220
+ If you want to allow public read access, but still require credentials for writing, then leave `basic_auth_read_only_username` and `basic_auth_read_only_password` unset, and set `allow_public_read` to `true`.
221
+
222
+ **Default:** `false`<br/>
223
+ **Allowed values:** `true`, `false`<br/>
224
+
225
+ ### public_heartbeat
226
+
227
+ If you have enabled basic auth, but require unauthenticated access to the heartbeat URL (eg. for use within an AWS autoscaling group), set `public_heartbeat` to `true`.
228
+
229
+ **Default:** `false`<br/>
230
+ **Allowed values:** `true`, `false`<br/>
231
+
232
+ ### enable_public_badge_access
233
+
234
+ Set this to true to allow status badges to be embedded in README files without requiring a hardcoded password.
235
+
236
+ **Default:** `false`<br/>
237
+ **Allowed values:** `true`, `false`<br/>
238
+
239
+ <br/>
240
+
241
+ ## Webhooks
242
+
243
+ <hr/>
244
+
245
+
246
+ ### webhook_retry_schedule
247
+
248
+ The schedule of seconds to wait between webhook execution attempts.
249
+ The default schedule is 10 sec, 1 min, 2 min, 5 min, 10 min, 20 min (38 minutes in total).
250
+
251
+ **Format:** A space separated list of integers.<br/>
252
+ **Default:** `10 60 120 300 600 1200`<br/>
253
+
254
+ ### webhook_http_method_whitelist
255
+
256
+ The allowed HTTP methods for webhooks.
257
+ It is highly recommended that only `POST` requests are allowed to ensure that webhooks cannot be used to retrieve sensitive information from hosts within the same network.
258
+
259
+ **Format:** A space separated list.<br/>
260
+ **Default:** `POST`<br/>
261
+ **Allowed values:** `POST`, `GET` (not recommended), `PUT` (not recommended), `PATCH` (not recommended), `DELETE` (not recommended)<br/>
262
+
263
+ ### webhook_http_code_success
264
+
265
+ If webhook call returns the response with an HTTP code that is listed in the success codes then the operation is
266
+ considered a success, otherwise the webhook will be re-triggered based on the `webhook_retry_schedule` configuration.
267
+
268
+ In most cases, configuring this is not necessary, but there are some CI systems that return a non 200 status for a success,
269
+ which is why this feature exists.
270
+
271
+ **Format:** A space separated list of integers.<br/>
272
+ **Default:** `200 201 202 203 204 205 206`<br/>
273
+ **Allowed values:** `Any valid HTTP status code`<br/>
274
+
275
+ ### webhook_scheme_whitelist
276
+
277
+ The allowed URL schemes for webhooks.
278
+
279
+ **Format:** A space delimited list.<br/>
280
+ **Default:** `https`<br/>
281
+ **Allowed values:** `https`, `http`<br/>
282
+
283
+ ### webhook_host_whitelist
284
+
285
+ A list of hosts, network ranges, or host regular expressions.
286
+ Regular expressions should start and end with a `/` to differentiate them from Strings.
287
+ Note that backslashes need to be escaped with a second backslash when setting via an environment variable.
288
+ Please read the Webhook whitelists section of the Pact Broker configuration documentation to understand how the whitelist is used.
289
+
290
+ **Examples:** `github.com`, `10.2.3.41/24`, `/.*\\.foo\\.com$/`<br/>
291
+ **More information:** https://docs.pact.io/pact_broker/configuration/#webhook-whitelists<br/>
292
+
293
+ ### disable_ssl_verification
294
+
295
+ If set to true, SSL verification will be disabled for the HTTP requests made by the webhooks
296
+
297
+ **Default:** `false`<br/>
298
+ **Allowed values:** `true`, `false`<br/>
299
+
300
+ <br/>
301
+
302
+ ## HTTP
303
+
304
+ <hr/>
305
+
306
+
307
+ ### port
308
+
309
+ The HTTP port that the Pact Broker application will run on. This will only be honoured if you are deploying the Pact Broker using
310
+ a package that actually reads this property (eg. one of the supported Docker images). If you are running the vanilla Ruby application,
311
+ the application will run on the port the server has been configured to run on (eg. `bundle exec rackup -p 9393`)
312
+
313
+ **Default:** `9292`<br/>
314
+
315
+ ### base_url
316
+
317
+ The full URL (including port, if non-standard for the protocol) at which the application will be made available to users.
318
+ This is used to create the links in the API.
319
+ The application may run correctly without this attribute, however, it is strongly recommended to set it when
320
+ deploying the Pact Broker to production as it prevents cache poisoning security vulnerabilities.
321
+ It is also required when deploying the Broker behind a reverse proxy, and when the application has been mounted at a non-root context.
322
+ Note that this attribute does not change where the application is actually mounted (that is the concern of the deployment configuration) - it just changes the links.
323
+
324
+ **Examples:** `https://pact-broker.mycompany.com`, `https://my-company.com:9292/pact-broker`<br/>
325
+
326
+ ### base_urls
327
+
328
+ An alias of base_url. From version 2.79.0, multiple base URLs can be configured for architectures that use
329
+ gateways or proxies that allow the same Pact Broker instance to be addressed with different base URLs.
330
+
331
+ **Format:** A space separated list.<br/>
332
+ **Example:** `http://my-internal-pact-broker:9292 https://my-external-pact-broker`<br/>
333
+
334
+ ### shields_io_base_url
335
+
336
+ The URL of the shields.io server used to generate the README badges.
337
+
338
+ **Default:** `https://img.shields.io`<br/>
339
+ **More information:** https://shields.io<br/>
340
+
341
+ <br/>
342
+
343
+ ## Domain
344
+
345
+ <hr/>
346
+
347
+
348
+ ### check_for_potential_duplicate_pacticipant_names
349
+
350
+ When a pact is published, the consumer, provider and consumer version resources are automatically created.
351
+
352
+ To prevent a pacticipant (consumer or provider) being created multiple times with slightly different name variants
353
+ (eg. FooBar/foo-bar/foo bar/Foo Bar Service), a check is performed to determine if a new pacticipant name is likely to be a duplicate
354
+ of any existing applications. If it is deemed similar enough to an existing name, a 409 will be returned.
355
+
356
+ The response body will contain instructions indicating that the pacticipant name should be corrected if it was intended to be an existing one,
357
+ or that the pacticipant should be created manually if it was intended to be a new one.
358
+
359
+ To turn this feature off, set `check_for_potential_duplicate_pacticipant_names` to `false`, and make sure everyone is very careful with their naming!
360
+ The usefulness of the Broker depends on the integrity of the data, which in turn depends on the correctness of the pacticipant names.
361
+
362
+ **Default:** `true`<br/>
363
+ **Allowed values:** `true`, `false`<br/>
364
+
365
+ ### create_deployed_versions_for_tags
366
+
367
+ When `create_deployed_versions_for_tags` is `true` and a tag is created, if there is an environment with the name of the newly created tag, a deployed version is
368
+ also created for the pacticipant version.
369
+
370
+ This is to assist in the migration from using tags to track deployments to using the deployed and released versions feature.
371
+
372
+ **Default:** `true`<br/>
373
+ **Allowed values:** `true`, `false`<br/>
374
+ **More information:** https://docs.pact.io/pact_broker/recording_deployments_and_releases/<br/>
375
+
376
+ ### use_first_tag_as_branch
377
+
378
+ When `use_first_tag_as_branch` is `true`, the first tag applied to a version within the `use_first_tag_as_branch_time_limit` (10 seconds)
379
+ will be used to populate the `branch` property of the version.
380
+
381
+ This is to assist in the migration from using tags to track branches to using the branches feature.
382
+
383
+ **Default:** `true`<br/>
384
+ **Allowed values:** `true`, `false`<br/>
385
+
386
+ <br/>
387
+
388
+ ## Miscellaneous
389
+
390
+ <hr/>
391
+
392
+
393
+ ### features
394
+
395
+ A list of features to enable in the Pact Broker for beta testing before public release.
396
+
397
+ **Format:** A space separated list.<br/>
398
+