pact_broker 2.95.1 → 2.98.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (36) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +31 -0
  3. data/Gemfile +1 -0
  4. data/docs/CONFIGURATION.md +120 -66
  5. data/lib/db.rb +1 -7
  6. data/lib/pact_broker/api/middleware/http_debug_logs.rb +36 -0
  7. data/lib/pact_broker/app.rb +3 -7
  8. data/lib/pact_broker/config/basic_auth_configuration.rb +7 -0
  9. data/lib/pact_broker/config/runtime_configuration.rb +22 -4
  10. data/lib/pact_broker/config/runtime_configuration_coercion_methods.rb +11 -0
  11. data/lib/pact_broker/config/runtime_configuration_database_methods.rb +6 -1
  12. data/lib/pact_broker/config/runtime_configuration_logging_methods.rb +13 -2
  13. data/lib/pact_broker/configuration.rb +2 -12
  14. data/lib/pact_broker/db/models.rb +2 -2
  15. data/lib/pact_broker/index/service.rb +2 -3
  16. data/lib/pact_broker/integrations/integration.rb +21 -6
  17. data/lib/pact_broker/integrations/service.rb +1 -1
  18. data/lib/pact_broker/matrix/repository.rb +2 -3
  19. data/lib/pact_broker/matrix/service.rb +0 -1
  20. data/lib/pact_broker/metrics/service.rb +2 -2
  21. data/lib/pact_broker/pacts/lazy_loaders.rb +26 -0
  22. data/lib/pact_broker/pacts/pact_publication.rb +13 -34
  23. data/lib/pact_broker/pacts/pact_version.rb +24 -28
  24. data/lib/pact_broker/pacts/pact_version_association_loaders.rb +36 -0
  25. data/lib/pact_broker/pacts/pacts_for_verification_repository.rb +9 -13
  26. data/lib/pact_broker/pacts/repository.rb +29 -25
  27. data/lib/pact_broker/repositories/helpers.rb +4 -0
  28. data/lib/pact_broker/test/http_test_data_builder.rb +8 -1
  29. data/lib/pact_broker/test/test_data_builder.rb +2 -1
  30. data/lib/pact_broker/ui/controllers/matrix.rb +14 -11
  31. data/lib/pact_broker/version.rb +1 -1
  32. data/pact_broker.gemspec +1 -1
  33. metadata +9 -16
  34. data/lib/pact_broker/matrix/aggregated_row.rb +0 -79
  35. data/lib/pact_broker/matrix/head_row.rb +0 -80
  36. data/lib/pact_broker/matrix/row.rb +0 -287
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f65cf2bd6eb2b3f0f7fd727e61fc73005817200f8e72bbab574493e4ea9b9ba3
4
- data.tar.gz: aac1fb501fc5624227e63d424c8982f266fa0a9a2d80b1184844193347ba6724
3
+ metadata.gz: d9aac85ace2c0ba5eaacc6fe462dbe4fc3d7623414f13a9bf351bc70d7a8b37f
4
+ data.tar.gz: 8bae3685f8b675c447aa986c0629875dad4e5e5e614411dea6ca75d77ed0918d
5
5
  SHA512:
6
- metadata.gz: 8272759e5880069606e56bea3893055df49543b76b237d7511ce8fa21c0414f1a0e593e98ed1f9e67c4b9048b4da1c2d3ef938b0dfea182406cda696111c2bc4
7
- data.tar.gz: 426a032f0016c8952934fbf630420be42accf192baeaff3bd2651aefa75170d055d8a4ed125640a7b3cad124cf5a461d7c930e5d289f4a6e5bd666366661940a
6
+ metadata.gz: d2249bef385597430fa0f9c296a4b83e489a71dc027b681f60c57e82efe6805403ae9054d996afeb2a65c20fa7f363e868dd754b4a589249c7a639e86b616c9d
7
+ data.tar.gz: 60605b088a39d895374fc10028525b012b7d3a33579ade4f9f3c9119b014fbbf7857a18bb2f09147c65059d35f37a0858fcd126a408ba010dbd1c82ccc7e7788
data/CHANGELOG.md CHANGED
@@ -1,3 +1,34 @@
1
+ <a name="v2.98.0"></a>
2
+ ### v2.98.0 (2022-03-29)
3
+
4
+ #### Features
5
+
6
+ * support debug logging of entire request and response ([42eb4a17](/../../commit/42eb4a17))
7
+
8
+ <a name="v2.97.0"></a>
9
+ ### v2.97.0 (2022-03-29)
10
+
11
+ #### Features
12
+
13
+ * **webhook certificates**
14
+ * support setting webhook certificates using environment variables ([82c7a7e5](/../../commit/82c7a7e5))
15
+
16
+ #### Bug Fixes
17
+
18
+ * do not set postgres connection driver options if database_statement_timeout is nil ([adec4b00](/../../commit/adec4b00))
19
+
20
+ <a name="v2.96.0"></a>
21
+ ### v2.96.0 (2022-03-21)
22
+
23
+ #### Features
24
+
25
+ * print final value of configuration attribute rather than source value ([9c0fd3c4](/../../commit/9c0fd3c4))
26
+
27
+ #### Bug Fixes
28
+
29
+ * ensure database and basic auth credentials are not coerced to arrays if they contain commas ([5bce7ce4](/../../commit/5bce7ce4))
30
+ * allow lazy loading when finding individual pacts ([04e03cb2](/../../commit/04e03cb2))
31
+
1
32
  <a name="v2.95.1"></a>
2
33
  ### v2.95.1 (2022-03-18)
3
34
 
data/Gemfile CHANGED
@@ -12,6 +12,7 @@ group :development do
12
12
  gem "rubocop", "~>1.1"
13
13
  gem "rubocop-performance", "~> 1.11"
14
14
  gem "sequel-annotate", "~>1.3"
15
+ gem "yard", "~> 0.9"
15
16
  end
16
17
 
17
18
  group :test do
@@ -19,8 +19,8 @@ variable `PACT_BROKER_CONF` to the full path to the configuration file.
19
19
 
20
20
  The application log level
21
21
 
22
- **YAML configuration key name:** `log_level`<br/>
23
22
  **Environment variable name:** `PACT_BROKER_LOG_LEVEL`<br/>
23
+ **YAML configuration key name:** `log_level`<br/>
24
24
  **Default:** `info`<br/>
25
25
  **Allowed values:** `debug`, `info`, `warn`, `error`, `fatal`<br/>
26
26
 
@@ -28,8 +28,8 @@ The application log level
28
28
 
29
29
  The application log format. Can be any value supported by Semantic Logger.
30
30
 
31
- **YAML configuration key name:** `log_format`<br/>
32
31
  **Environment variable name:** `PACT_BROKER_LOG_FORMAT`<br/>
32
+ **YAML configuration key name:** `log_format`<br/>
33
33
  **Default:** `default`<br/>
34
34
  **Allowed values:** `default`, `json`, `color`<br/>
35
35
  **More information:** https://github.com/rocketjob/semantic_logger/tree/master/lib/semantic_logger/formatters<br/>
@@ -38,8 +38,8 @@ The application log format. Can be any value supported by Semantic Logger.
38
38
 
39
39
  The log file directory
40
40
 
41
- **YAML configuration key name:** `log_dir`<br/>
42
41
  **Environment variable name:** `PACT_BROKER_LOG_DIR`<br/>
42
+ **YAML configuration key name:** `log_dir`<br/>
43
43
  **Default:** `./logs`<br/>
44
44
 
45
45
  ### log_stream
@@ -48,17 +48,28 @@ The stream to which the logs will be sent.
48
48
 
49
49
  While the default is `file` for the Ruby application, it is set to `stdout` on the supported Docker images.
50
50
 
51
- **YAML configuration key name:** `log_stream`<br/>
52
51
  **Environment variable name:** `PACT_BROKER_LOG_STREAM`<br/>
52
+ **YAML configuration key name:** `log_stream`<br/>
53
53
  **Default:** `file`<br/>
54
54
  **Allowed values:** `stdout`, `file`<br/>
55
55
 
56
+ ### http_debug_logging_enabled
57
+
58
+ Enable this setting to print the entire request and response to the logs at debug level. Used for troubleshooting issues.
59
+ Do not leave this on permanently, as it will have performance and security issues.
60
+
61
+ **Supported versions:** From v2.98.0<br/>
62
+ **Environment variable name:** `PACT_BROKER_HTTP_DEBUG_LOGGING_ENABLED`<br/>
63
+ **YAML configuration key name:** `http_debug_logging_enabled`<br/>
64
+ **Default:** `false`<br/>
65
+ **Allowed values:** `true`, `false`<br/>
66
+
56
67
  ### hide_pactflow_messages
57
68
 
58
69
  Set to `true` to hide the messages in the logs about Pactflow
59
70
 
60
- **YAML configuration key name:** `hide_pactflow_messages`<br/>
61
71
  **Environment variable name:** `PACT_BROKER_HIDE_PACTFLOW_MESSAGES`<br/>
72
+ **YAML configuration key name:** `hide_pactflow_messages`<br/>
62
73
  **Default:** `true`<br/>
63
74
  **Allowed values:** `true`, `false`<br/>
64
75
  **More information:** https://pactflow.io<br/>
@@ -77,8 +88,8 @@ The database adapter. For production use, Postgres must be used.
77
88
  For investigations/spikes on a development machine, you can use SQlite. It is not supported as a production database, as it does not support
78
89
  concurrent requests.
79
90
 
80
- **YAML configuration key name:** `database_adapter`<br/>
81
91
  **Environment variable name:** `PACT_BROKER_DATABASE_ADAPTER`<br/>
92
+ **YAML configuration key name:** `database_adapter`<br/>
82
93
  **Default:** `postgres`<br/>
83
94
  **Allowed values:** `postgres` (for production use), `sqlite` (for spikes only)<br/>
84
95
 
@@ -86,44 +97,44 @@ concurrent requests.
86
97
 
87
98
  The database username
88
99
 
89
- **YAML configuration key name:** `database_username`<br/>
90
100
  **Environment variable name:** `PACT_BROKER_DATABASE_USERNAME`<br/>
101
+ **YAML configuration key name:** `database_username`<br/>
91
102
 
92
103
  ### database_password
93
104
 
94
105
  The database password
95
106
 
96
- **YAML configuration key name:** `database_password`<br/>
97
107
  **Environment variable name:** `PACT_BROKER_DATABASE_PASSWORD`<br/>
108
+ **YAML configuration key name:** `database_password`<br/>
98
109
 
99
110
  ### database_name
100
111
 
101
112
  The database name. If using the `sqlite` adapter, this will be the path to the database file.
102
113
 
103
- **YAML configuration key name:** `database_name`<br/>
104
114
  **Environment variable name:** `PACT_BROKER_DATABASE_NAME`<br/>
115
+ **YAML configuration key name:** `database_name`<br/>
105
116
  **Examples:** `pact_broker`, `/tmp/pact_broker.sqlite3`, `./tmp/pact_broker.sqlite3`<br/>
106
117
 
107
118
  ### database_host
108
119
 
109
120
  The database host
110
121
 
111
- **YAML configuration key name:** `database_host`<br/>
112
122
  **Environment variable name:** `PACT_BROKER_DATABASE_HOST`<br/>
123
+ **YAML configuration key name:** `database_host`<br/>
113
124
 
114
125
  ### database_port
115
126
 
116
127
  The database port. If ommited, the default port for the adapter will be used.
117
128
 
118
- **YAML configuration key name:** `database_port`<br/>
119
129
  **Environment variable name:** `PACT_BROKER_DATABASE_PORT`<br/>
130
+ **YAML configuration key name:** `database_port`<br/>
120
131
 
121
132
  ### database_url
122
133
 
123
134
  The full database URL may be specified instead of the separate adapter, username, password, name, host and port.
124
135
 
125
- **YAML configuration key name:** `database_url`<br/>
126
136
  **Environment variable name:** `PACT_BROKER_DATABASE_URL`<br/>
137
+ **YAML configuration key name:** `database_url`<br/>
127
138
  **Format:** `{database_adapter}://{database_username}:{database_password}@{database_host}:{database_port}/{database_name}`<br/>
128
139
  **Examples:** `postgres://pact_broker_user:pact_broker_password@pact_broker_db_host/pact_broker`, `sqlite:///tmp/pact_broker.sqlite3` (relative path to working directory), `sqlite:////tmp/pact_broker.sqlite3` (absolute path)<br/>
129
140
 
@@ -131,8 +142,8 @@ The full database URL may be specified instead of the separate adapter, username
131
142
 
132
143
  The Postgresql ssl mode.
133
144
 
134
- **YAML configuration key name:** `database_sslmode`<br/>
135
145
  **Environment variable name:** `PACT_BROKER_DATABASE_SSLMODE`<br/>
146
+ **YAML configuration key name:** `database_sslmode`<br/>
136
147
  **Default:** `prefer`<br/>
137
148
  **Allowed values:** `disable`, `allow`, `prefer`, `require`, `verify-ca`, `verify-full`<br/>
138
149
  **More information:** https://ankane.org/postgres-sslmode-explained<br/>
@@ -143,8 +154,8 @@ The log level that will be used when the SQL query statements are logged.
143
154
 
144
155
  To disable noisy SQL query logging when the application `log_level` is set to `debug` for other reasons, use the value `none`.
145
156
 
146
- **YAML configuration key name:** `sql_log_level`<br/>
147
157
  **Environment variable name:** `PACT_BROKER_SQL_LOG_LEVEL`<br/>
158
+ **YAML configuration key name:** `sql_log_level`<br/>
148
159
  **Default:** `debug`<br/>
149
160
  **Allowed values:** `none`, `debug`, `info`, `warn`, `error`, `fatal`<br/>
150
161
 
@@ -152,18 +163,29 @@ To disable noisy SQL query logging when the application `log_level` is set to `d
152
163
 
153
164
  The number of seconds after which to log an SQL query at warn level. Use this for detecting slow queries.
154
165
 
155
- **YAML configuration key name:** `sql_log_warn_duration`<br/>
156
166
  **Environment variable name:** `PACT_BROKER_SQL_LOG_WARN_DURATION`<br/>
167
+ **YAML configuration key name:** `sql_log_warn_duration`<br/>
157
168
  **Default:** `5`<br/>
158
169
  **Allowed values:** A positive integer or float, as a string.<br/>
159
170
  **More information:** https://sequel.jeremyevans.net/rdoc/files/doc/opening_databases_rdoc.html#label-General+connection+options<br/>
160
171
 
172
+ ### sql_enable_caller_logging
173
+
174
+ Whether or not to enable caller_logging extension for database connection.
175
+ When enabled it logs source path that caused SQL query.
176
+
177
+ **Environment variable name:** `PACT_BROKER_SQL_ENABLE_CALLER_LOGGING`<br/>
178
+ **YAML configuration key name:** `sql_enable_caller_logging`<br/>
179
+ **Default:** `false`<br/>
180
+ **Allowed values:** `true`, `false`<br/>
181
+ **More information:** https://sequel.jeremyevans.net/rdoc-plugins/files/lib/sequel/extensions/caller_logging_rb.html<br/>
182
+
161
183
  ### database_max_connections
162
184
 
163
185
  The maximum size of the connection pool (4 connections by default on most databases)
164
186
 
165
- **YAML configuration key name:** `database_max_connections`<br/>
166
187
  **Environment variable name:** `PACT_BROKER_DATABASE_MAX_CONNECTIONS`<br/>
188
+ **YAML configuration key name:** `database_max_connections`<br/>
167
189
  **Default:** `4`<br/>
168
190
  **Allowed values:** A positive integer value.<br/>
169
191
  **More information:** https://sequel.jeremyevans.net/rdoc/files/doc/opening_databases_rdoc.html#label-General+connection+options<br/>
@@ -172,8 +194,8 @@ The maximum size of the connection pool (4 connections by default on most databa
172
194
 
173
195
  The number of seconds to wait if a connection cannot be acquired before raising an error
174
196
 
175
- **YAML configuration key name:** `database_pool_timeout`<br/>
176
197
  **Environment variable name:** `PACT_BROKER_DATABASE_POOL_TIMEOUT`<br/>
198
+ **YAML configuration key name:** `database_pool_timeout`<br/>
177
199
  **Default:** `5`<br/>
178
200
  **Allowed values:** A positive integer.<br/>
179
201
  **More information:** https://sequel.jeremyevans.net/rdoc/files/doc/opening_databases_rdoc.html#label-General+connection+options<br/>
@@ -185,8 +207,8 @@ the Broker application process may be ready before the database is available for
185
207
  container to exit with an error. Setting the max retries to a non-zero number will allow it to retry the connection the
186
208
  configured number of times, waiting 3 seconds between attempts.
187
209
 
188
- **YAML configuration key name:** `database_connect_max_retries`<br/>
189
210
  **Environment variable name:** `PACT_BROKER_DATABASE_CONNECT_MAX_RETRIES`<br/>
211
+ **YAML configuration key name:** `database_connect_max_retries`<br/>
190
212
  **Default:** `0`<br/>
191
213
  **Allowed values:** A positive integer value.<br/>
192
214
 
@@ -194,8 +216,8 @@ configured number of times, waiting 3 seconds between attempts.
194
216
 
195
217
  Whether or not to run the database schema migrations on start up. It is recommended to set this to `true`.
196
218
 
197
- **YAML configuration key name:** `auto_migrate_db`<br/>
198
219
  **Environment variable name:** `PACT_BROKER_AUTO_MIGRATE_DB`<br/>
220
+ **YAML configuration key name:** `auto_migrate_db`<br/>
199
221
  **Default:** `true`<br/>
200
222
  **Allowed values:** `true`, `false`<br/>
201
223
 
@@ -203,8 +225,8 @@ Whether or not to run the database schema migrations on start up. It is recommen
203
225
 
204
226
  Whether or not to run the database data migrations on start up. It is recommended to set this to `true`.
205
227
 
206
- **YAML configuration key name:** `auto_migrate_db_data`<br/>
207
228
  **Environment variable name:** `PACT_BROKER_AUTO_MIGRATE_DB_DATA`<br/>
229
+ **YAML configuration key name:** `auto_migrate_db_data`<br/>
208
230
  **Default:** `true`<br/>
209
231
  **Allowed values:** `true`, `false`<br/>
210
232
 
@@ -214,8 +236,8 @@ If `true`, will not raise an error if a database migration is recorded in the da
214
236
  equivalent file in the codebase. If this is true, an older version of the code may be used with a newer version of the database,
215
237
  however, data integrity issues may occur.
216
238
 
217
- **YAML configuration key name:** `allow_missing_migration_files`<br/>
218
239
  **Environment variable name:** `PACT_BROKER_ALLOW_MISSING_MIGRATION_FILES`<br/>
240
+ **YAML configuration key name:** `allow_missing_migration_files`<br/>
219
241
  **Default:** `true`<br/>
220
242
  **More information:** https://sequel.jeremyevans.net/rdoc/classes/Sequel/Migrator.html<br/>
221
243
 
@@ -223,8 +245,8 @@ however, data integrity issues may occur.
223
245
 
224
246
  The number of seconds after which an SQL query will be aborted. Only supported for Postgresql connections.
225
247
 
226
- **YAML configuration key name:** `database_statement_timeout`<br/>
227
248
  **Environment variable name:** `PACT_BROKER_DATABASE_STATEMENT_TIMEOUT`<br/>
249
+ **YAML configuration key name:** `database_statement_timeout`<br/>
228
250
  **Default:** `15`<br/>
229
251
  **Allowed values:** A positive integer or float.<br/>
230
252
  **More information:** https://www.postgresql.org/docs/9.3/runtime-config-client.html<br/>
@@ -235,8 +257,8 @@ The number of seconds after which the SQL queries used for the metrics endpoint
235
257
  This is configurable separately from the standard `database_statement_timeout` as it may need to be significantly
236
258
  longer than the desired value for standard queries.
237
259
 
238
- **YAML configuration key name:** `metrics_sql_statement_timeout`<br/>
239
260
  **Environment variable name:** `PACT_BROKER_METRICS_SQL_STATEMENT_TIMEOUT`<br/>
261
+ **YAML configuration key name:** `metrics_sql_statement_timeout`<br/>
240
262
  **Default:** `30`<br/>
241
263
  **Allowed values:** A positive integer.<br/>
242
264
 
@@ -248,8 +270,8 @@ The number of seconds after which to check the health of a connection from a con
248
270
  when databases are restarted and connections are killed. This has a performance
249
271
  penalty, so consider increasing this timeout if building a frequently accessed service.
250
272
 
251
- **YAML configuration key name:** `database_connection_validation_timeout`<br/>
252
273
  **Environment variable name:** `PACT_BROKER_DATABASE_CONNECTION_VALIDATION_TIMEOUT`<br/>
274
+ **YAML configuration key name:** `database_connection_validation_timeout`<br/>
253
275
  **Default:** -1 for v2.85.1 and earlier, 3600 for later versions.<br/>
254
276
  **Allowed values:** -1 or any positive integer.<br/>
255
277
  **More information:** https://sequel.jeremyevans.net/rdoc-plugins/files/lib/sequel/extensions/connection_validator_rb.html<br/>
@@ -268,8 +290,8 @@ should be used for CI/CD.
268
290
 
269
291
  Whether to enable basic authorization. This is automatically set to true for the Docker images if the `basic_auth_username` and `basic_auth_password` are set.
270
292
 
271
- **YAML configuration key name:** `basic_auth_enabled`<br/>
272
293
  **Environment variable name:** `PACT_BROKER_BASIC_AUTH_ENABLED`<br/>
294
+ **YAML configuration key name:** `basic_auth_enabled`<br/>
273
295
  **Default:** `false`<br/>
274
296
  **Allowed values:** `true`, `false`<br/>
275
297
 
@@ -277,36 +299,36 @@ Whether to enable basic authorization. This is automatically set to true for the
277
299
 
278
300
  The username for the read/write basic auth user.
279
301
 
280
- **YAML configuration key name:** `basic_auth_username`<br/>
281
302
  **Environment variable name:** `PACT_BROKER_BASIC_AUTH_USERNAME`<br/>
303
+ **YAML configuration key name:** `basic_auth_username`<br/>
282
304
 
283
305
  ### basic_auth_password
284
306
 
285
307
  The password for the read/write basic auth user.
286
308
 
287
- **YAML configuration key name:** `basic_auth_password`<br/>
288
309
  **Environment variable name:** `PACT_BROKER_BASIC_AUTH_PASSWORD`<br/>
310
+ **YAML configuration key name:** `basic_auth_password`<br/>
289
311
 
290
312
  ### basic_auth_read_only_username
291
313
 
292
314
  The username for the read only basic auth user.
293
315
 
294
- **YAML configuration key name:** `basic_auth_read_only_username`<br/>
295
316
  **Environment variable name:** `PACT_BROKER_BASIC_AUTH_READ_ONLY_USERNAME`<br/>
317
+ **YAML configuration key name:** `basic_auth_read_only_username`<br/>
296
318
 
297
319
  ### basic_auth_read_only_password
298
320
 
299
321
  The password for the read only basic auth user.
300
322
 
301
- **YAML configuration key name:** `basic_auth_read_only_password`<br/>
302
323
  **Environment variable name:** `PACT_BROKER_BASIC_AUTH_READ_ONLY_PASSWORD`<br/>
324
+ **YAML configuration key name:** `basic_auth_read_only_password`<br/>
303
325
 
304
326
  ### allow_public_read
305
327
 
306
328
  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`.
307
329
 
308
- **YAML configuration key name:** `allow_public_read`<br/>
309
330
  **Environment variable name:** `PACT_BROKER_ALLOW_PUBLIC_READ`<br/>
331
+ **YAML configuration key name:** `allow_public_read`<br/>
310
332
  **Default:** `false`<br/>
311
333
  **Allowed values:** `true`, `false`<br/>
312
334
 
@@ -314,8 +336,8 @@ If you want to allow public read access, but still require credentials for writi
314
336
 
315
337
  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`.
316
338
 
317
- **YAML configuration key name:** `public_heartbeat`<br/>
318
339
  **Environment variable name:** `PACT_BROKER_PUBLIC_HEARTBEAT`<br/>
340
+ **YAML configuration key name:** `public_heartbeat`<br/>
319
341
  **Default:** `false`<br/>
320
342
  **Allowed values:** `true`, `false`<br/>
321
343
 
@@ -323,8 +345,8 @@ If you have enabled basic auth, but require unauthenticated access to the heartb
323
345
 
324
346
  Set this to true to allow status badges to be embedded in README files without requiring a hardcoded password.
325
347
 
326
- **YAML configuration key name:** `enable_public_badge_access`<br/>
327
348
  **Environment variable name:** `PACT_BROKER_ENABLE_PUBLIC_BADGE_ACCESS`<br/>
349
+ **YAML configuration key name:** `enable_public_badge_access`<br/>
328
350
  **Default:** `false`<br/>
329
351
  **Allowed values:** `true`, `false`<br/>
330
352
 
@@ -340,8 +362,8 @@ Set this to true to allow status badges to be embedded in README files without r
340
362
  The schedule of seconds to wait between webhook execution attempts.
341
363
  The default schedule is 10 sec, 1 min, 2 min, 5 min, 10 min, 20 min (38 minutes in total).
342
364
 
343
- **YAML configuration key name:** `webhook_retry_schedule`<br/>
344
365
  **Environment variable name:** `PACT_BROKER_WEBHOOK_RETRY_SCHEDULE`<br/>
366
+ **YAML configuration key name:** `webhook_retry_schedule`<br/>
345
367
  **Format:** A space separated list of integers.<br/>
346
368
  **Default:** `10 60 120 300 600 1200`<br/>
347
369
 
@@ -350,8 +372,8 @@ The default schedule is 10 sec, 1 min, 2 min, 5 min, 10 min, 20 min (38 minutes
350
372
  The allowed HTTP methods for webhooks.
351
373
  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.
352
374
 
353
- **YAML configuration key name:** `webhook_http_method_whitelist`<br/>
354
375
  **Environment variable name:** `PACT_BROKER_WEBHOOK_HTTP_METHOD_WHITELIST`<br/>
376
+ **YAML configuration key name:** `webhook_http_method_whitelist`<br/>
355
377
  **Format:** A space separated list.<br/>
356
378
  **Default:** `POST`<br/>
357
379
  **Allowed values:** `POST`, `GET` (not recommended), `PUT` (not recommended), `PATCH` (not recommended), `DELETE` (not recommended)<br/>
@@ -364,8 +386,8 @@ considered a success, otherwise the webhook will be re-triggered based on the `w
364
386
  In most cases, configuring this is not necessary, but there are some CI systems that return a non 200 status for a success,
365
387
  which is why this feature exists.
366
388
 
367
- **YAML configuration key name:** `webhook_http_code_success`<br/>
368
389
  **Environment variable name:** `PACT_BROKER_WEBHOOK_HTTP_CODE_SUCCESS`<br/>
390
+ **YAML configuration key name:** `webhook_http_code_success`<br/>
369
391
  **Format:** A space separated list of integers.<br/>
370
392
  **Default:** `200 201 202 203 204 205 206`<br/>
371
393
  **Allowed values:** `Any valid HTTP status code`<br/>
@@ -374,8 +396,8 @@ which is why this feature exists.
374
396
 
375
397
  The allowed URL schemes for webhooks.
376
398
 
377
- **YAML configuration key name:** `webhook_scheme_whitelist`<br/>
378
399
  **Environment variable name:** `PACT_BROKER_WEBHOOK_SCHEME_WHITELIST`<br/>
400
+ **YAML configuration key name:** `webhook_scheme_whitelist`<br/>
379
401
  **Format:** A space delimited list.<br/>
380
402
  **Default:** `https`<br/>
381
403
  **Allowed values:** `https`, `http`<br/>
@@ -387,37 +409,69 @@ Regular expressions should start and end with a `/` to differentiate them from S
387
409
  Note that backslashes need to be escaped with a second backslash when setting via an environment variable.
388
410
  Please read the [Webhook whitelists section](https://docs.pact.io/pact_broker/configuration/features#webhooks) of the Pact Broker configuration documentation to understand how the whitelist is used.
389
411
 
390
- **YAML configuration key name:** `webhook_host_whitelist`<br/>
391
412
  **Environment variable name:** `PACT_BROKER_WEBHOOK_HOST_WHITELIST`<br/>
413
+ **Environment variable format:** A space separated list.<br/>
414
+ **YAML configuration key name:** `webhook_host_whitelist`<br/>
415
+ **YAML format:** A YAML list.<br/>
392
416
  **Examples:** `github.com`, `10.2.3.41/24`, `/.*\\.foo\\.com$/`<br/>
393
417
  **More information:** https://docs.pact.io/pact_broker/configuration/#webhook-whitelists<br/>
394
418
 
395
419
  ### webhook_certificates
396
420
 
397
- A list of SSL certificate configuration objects with the keys `description`, and either `content` or `path`. These
421
+ A list of SSL certificate configuration objects with the key `description`, and either `content` or `path`. These
398
422
  certificates are used when a webhook needs to connect to a server that uses a self signed certificate.
399
423
 
400
424
  Each certificate configuration item accepts a chain of certificates in PEM format - there may be multiple 'BEGIN CERTIFICATE' and 'END CERTIFICATE' in the content of each item.
401
425
 
402
- When setting the content, use the syntax "content: |-" followed by a new line, and then the contents of the certificate
403
- chain in PEM format, indented by 2 more characters.
404
-
405
- When setting the path, the full path to the certificate file in PEM format must be specified.
406
-
407
426
  The certificate configuration is not validated on startup. If any of the configured certificates cannot be loaded during the execution of a webhook, an error
408
427
  will be logged, and they will be ignored. You can check if the configuration is working by testing the execution of
409
428
  a webhook that connects to the server with the self signed certificate by following these instructions https://docs.pact.io/pact_broker/webhooks/debugging_webhooks#testing-webhook-execution
410
429
 
411
- **YAML configuration key name:** `webhook_certificates`<br/>
430
+ When setting the content in the YAML file, use the syntax "content: |-" followed by a new line, and then the contents of the certificate
431
+ chain in PEM format, indented by 2 more characters.
432
+
433
+ When setting the path, the full path to the certificate file in PEM format must be specified. When using Docker, you must ensure the
434
+ certificate file is [mounted into the container](https://docs.docker.com/storage/volumes/).
435
+
436
+ YAML Example:
437
+
438
+ ```yaml
439
+ webhook_certificates:
440
+ - description: "An example self signed certificate with content"
441
+ content: |-
442
+ -----BEGIN CERTIFICATE-----
443
+ MIIDZDCCAkygAwIBAgIBATANBgkqhkiG9w0BAQsFADBCMRMwEQYKCZImiZPyLGQB
444
+ <REST OF CERTIFICATE>
445
+ jHT1Ty2CglM=
446
+ -----END CERTIFICATE-----
447
+ - description: "An example self signed certificate with a path"
448
+ path: "/full/path/to/the/cert.pem"
449
+
450
+ ```
451
+
452
+ Environment variable example:
453
+
454
+ ```shell
455
+ PACT_BROKER_WEBHOOK_CERTIFICATES__0__LABEL="An example self signed certificate with content"
456
+ PACT_BROKER_WEBHOOK_CERTIFICATES__0__CONTENT="-----BEGIN CERTIFICATE-----
457
+ MIIDZDCCAkygAwIBAgIBATANBgkqhkiG9w0BAQsFADBCMRMwEQYKCZImiZPyLGQB
458
+ <REST OF CERTIFICATE>
459
+ jHT1Ty2CglM=
460
+ -----END CERTIFICATE-----"
461
+ PACT_BROKER_WEBHOOK_CERTIFICATES__1__LABEL="An example self signed certificate with a path"
462
+ PACT_BROKER_WEBHOOK_CERTIFICATES__1__PATH="/full/path/to/the/cert.pem"
463
+ ```
464
+
465
+ **Supported versions:** From v2.90.0 for YAML and 2.97.0 for environment variables.<br/>
412
466
  **Environment variable name:** `PACT_BROKER_WEBHOOK_CERTIFICATES`<br/>
413
- **Supported versions:** From v2.90.0<br/>
467
+ **YAML configuration key name:** `webhook_certificates`<br/>
414
468
 
415
469
  ### disable_ssl_verification
416
470
 
417
471
  If set to true, SSL verification will be disabled for the HTTP requests made by the webhooks
418
472
 
419
- **YAML configuration key name:** `disable_ssl_verification`<br/>
420
473
  **Environment variable name:** `PACT_BROKER_DISABLE_SSL_VERIFICATION`<br/>
474
+ **YAML configuration key name:** `disable_ssl_verification`<br/>
421
475
  **Default:** `false`<br/>
422
476
  **Allowed values:** `true`, `false`<br/>
423
477
 
@@ -425,8 +479,8 @@ If set to true, SSL verification will be disabled for the HTTP requests made by
425
479
 
426
480
  The user agent to set when making HTTP requests for webhooks.
427
481
 
428
- **YAML configuration key name:** `user_agent`<br/>
429
482
  **Environment variable name:** `PACT_BROKER_USER_AGENT`<br/>
483
+ **YAML configuration key name:** `user_agent`<br/>
430
484
  **Default:** `Pact Broker v{VERSION}`<br/>
431
485
 
432
486
  <br/>
@@ -442,8 +496,8 @@ The HTTP port that the Pact Broker application will run on. This will only be ho
442
496
  a package that actually reads this property (eg. one of the supported Docker images). If you are running the vanilla Ruby application,
443
497
  the application will run on the port the server has been configured to run on (eg. `bundle exec rackup -p 9393`)
444
498
 
445
- **YAML configuration key name:** `port`<br/>
446
499
  **Environment variable name:** `PACT_BROKER_PORT`<br/>
500
+ **YAML configuration key name:** `port`<br/>
447
501
  **Default:** `9292`<br/>
448
502
 
449
503
  ### base_url
@@ -455,8 +509,8 @@ deploying the Pact Broker to production as it prevents cache poisoning security
455
509
  It is also required when deploying the Broker behind a reverse proxy, and when the application has been mounted at a non-root context.
456
510
  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.
457
511
 
458
- **YAML configuration key name:** `base_url`<br/>
459
512
  **Environment variable name:** `PACT_BROKER_BASE_URL`<br/>
513
+ **YAML configuration key name:** `base_url`<br/>
460
514
  **Examples:** `https://pact-broker.mycompany.com`, `https://my-company.com:9292/pact-broker`<br/>
461
515
 
462
516
  ### base_urls
@@ -464,8 +518,8 @@ Note that this attribute does not change where the application is actually mount
464
518
  An alias of base_url. From version 2.79.0, multiple base URLs can be configured for architectures that use
465
519
  gateways or proxies that allow the same Pact Broker instance to be addressed with different base URLs.
466
520
 
467
- **YAML configuration key name:** `base_urls`<br/>
468
521
  **Environment variable name:** `PACT_BROKER_BASE_URLS`<br/>
522
+ **YAML configuration key name:** `base_urls`<br/>
469
523
  **Format:** A space separated list.<br/>
470
524
  **Example:** `http://my-internal-pact-broker:9292 https://my-external-pact-broker`<br/>
471
525
 
@@ -473,8 +527,8 @@ gateways or proxies that allow the same Pact Broker instance to be addressed wit
473
527
 
474
528
  The URL of the shields.io server used to generate the README badges.
475
529
 
476
- **YAML configuration key name:** `shields_io_base_url`<br/>
477
530
  **Environment variable name:** `PACT_BROKER_SHIELDS_IO_BASE_URL`<br/>
531
+ **YAML configuration key name:** `shields_io_base_url`<br/>
478
532
  **Default:** `https://img.shields.io`<br/>
479
533
  **More information:** https://shields.io<br/>
480
534
 
@@ -485,8 +539,8 @@ to render the badge from the shields.io server directly in the browser. This is
485
539
  When set to `proxy`, the Pact Broker will make a request directly to the configured shields.io server, and then send the returned file
486
540
  back to the browser. This mode is not recommended for security and performance reasons.
487
541
 
488
- **YAML configuration key name:** `badge_provider_mode`<br/>
489
542
  **Environment variable name:** `PACT_BROKER_BADGE_PROVIDER_MODE`<br/>
543
+ **YAML configuration key name:** `badge_provider_mode`<br/>
490
544
  **Default:** `redirect`<br/>
491
545
  **Allowed values:** `redirect`, `proxy`<br/>
492
546
 
@@ -496,8 +550,8 @@ Whether or not to enable the diagnostic endpoints at `/diagnostic/status/heartbe
496
550
  The heartbeat endpoint is for use by load balancers, and the dependencies endpoint is for checking that the database
497
551
  is available (do not use this for load balancing, as it makes a database connection).
498
552
 
499
- **YAML configuration key name:** `enable_diagnostic_endpoints`<br/>
500
553
  **Environment variable name:** `PACT_BROKER_ENABLE_DIAGNOSTIC_ENDPOINTS`<br/>
554
+ **YAML configuration key name:** `enable_diagnostic_endpoints`<br/>
501
555
  **Default:** `true`<br/>
502
556
  **Allowed values:** `true`, `false`<br/>
503
557
 
@@ -505,8 +559,8 @@ is available (do not use this for load balancing, as it makes a database connect
505
559
 
506
560
  Whether or not to enable the embedded HAL Browser.
507
561
 
508
- **YAML configuration key name:** `use_hal_browser`<br/>
509
562
  **Environment variable name:** `PACT_BROKER_USE_HAL_BROWSER`<br/>
563
+ **YAML configuration key name:** `use_hal_browser`<br/>
510
564
  **Default:** `true`<br/>
511
565
  **Allowed values:** `true`, `false`<br/>
512
566
  **More information:** https://github.com/mikekelly/hal-browser<br/>
@@ -532,8 +586,8 @@ or that the pacticipant should be created manually if it was intended to be a ne
532
586
  To turn this feature off, set `check_for_potential_duplicate_pacticipant_names` to `false`, and make sure everyone is very careful with their naming!
533
587
  The usefulness of the Broker depends on the integrity of the data, which in turn depends on the correctness of the pacticipant names.
534
588
 
535
- **YAML configuration key name:** `check_for_potential_duplicate_pacticipant_names`<br/>
536
589
  **Environment variable name:** `PACT_BROKER_CHECK_FOR_POTENTIAL_DUPLICATE_PACTICIPANT_NAMES`<br/>
590
+ **YAML configuration key name:** `check_for_potential_duplicate_pacticipant_names`<br/>
537
591
  **Default:** `true`<br/>
538
592
  **Allowed values:** `true`, `false`<br/>
539
593
 
@@ -544,9 +598,9 @@ also created for the pacticipant version.
544
598
 
545
599
  This is to assist in the migration from using tags to track deployments to using the deployed and released versions feature.
546
600
 
547
- **YAML configuration key name:** `create_deployed_versions_for_tags`<br/>
548
- **Environment variable name:** `PACT_BROKER_CREATE_DEPLOYED_VERSIONS_FOR_TAGS`<br/>
549
601
  **Supported versions:** From v2.81.0<br/>
602
+ **Environment variable name:** `PACT_BROKER_CREATE_DEPLOYED_VERSIONS_FOR_TAGS`<br/>
603
+ **YAML configuration key name:** `create_deployed_versions_for_tags`<br/>
550
604
  **Default:** `true`<br/>
551
605
  **Allowed values:** `true`, `false`<br/>
552
606
  **More information:** https://docs.pact.io/pact_broker/recording_deployments_and_releases/<br/>
@@ -558,9 +612,9 @@ will be used to populate the `branch` property of the version.
558
612
 
559
613
  This is to assist in the migration from using tags to track branches to using the branches feature.
560
614
 
561
- **YAML configuration key name:** `use_first_tag_as_branch`<br/>
562
- **Environment variable name:** `PACT_BROKER_USE_FIRST_TAG_AS_BRANCH`<br/>
563
615
  **Supported versions:** From v2.82.0<br/>
616
+ **Environment variable name:** `PACT_BROKER_USE_FIRST_TAG_AS_BRANCH`<br/>
617
+ **YAML configuration key name:** `use_first_tag_as_branch`<br/>
564
618
  **Default:** `true`<br/>
565
619
  **Allowed values:** `true`, `false`<br/>
566
620
 
@@ -571,9 +625,9 @@ the `mainBranch` property is set for that pacticipant if it is not already set.
571
625
 
572
626
  This is to assist in the migration from using tags to track branches to using the branches feature.
573
627
 
574
- **YAML configuration key name:** `auto_detect_main_branch`<br/>
575
- **Environment variable name:** `PACT_BROKER_AUTO_DETECT_MAIN_BRANCH`<br/>
576
628
  **Supported versions:** From v2.82.0<br/>
629
+ **Environment variable name:** `PACT_BROKER_AUTO_DETECT_MAIN_BRANCH`<br/>
630
+ **YAML configuration key name:** `auto_detect_main_branch`<br/>
577
631
  **Default:** `true`<br/>
578
632
  **Allowed values:** `true`, `false`<br/>
579
633
 
@@ -581,9 +635,9 @@ This is to assist in the migration from using tags to track branches to using th
581
635
 
582
636
  An array of potential main branch names used when automatically detecting the main branch for a pacticipant.
583
637
 
584
- **YAML configuration key name:** `main_branch_candidates`<br/>
585
- **Environment variable name:** `PACT_BROKER_MAIN_BRANCH_CANDIDATES`<br/>
586
638
  **Supported versions:** From v2.82.0<br/>
639
+ **Environment variable name:** `PACT_BROKER_MAIN_BRANCH_CANDIDATES`<br/>
640
+ **YAML configuration key name:** `main_branch_candidates`<br/>
587
641
  **Format:** A space delimited list.<br/>
588
642
  **Default:** `develop main master`<br/>
589
643
 
@@ -593,9 +647,9 @@ Whether or not to allow the pact content for an existing consumer version to be
593
647
  as allowing modification makes the results of can-i-deploy unreliable. When this is set to false as recommended, each commit must publish pacts
594
648
  with a unique version number.
595
649
 
596
- **YAML configuration key name:** `allow_dangerous_contract_modification`<br/>
597
- **Environment variable name:** `PACT_BROKER_ALLOW_DANGEROUS_CONTRACT_MODIFICATION`<br/>
598
650
  **Supported versions:** From v2.82.0<br/>
651
+ **Environment variable name:** `PACT_BROKER_ALLOW_DANGEROUS_CONTRACT_MODIFICATION`<br/>
652
+ **YAML configuration key name:** `allow_dangerous_contract_modification`<br/>
599
653
  **Default:** For new installations of v2.82.0 and later, this defaults to `false`.<br/>
600
654
  **Allowed values:** `true`, `false`<br/>
601
655
  **More information:** https://docs.pact.io/versioning<br/>
@@ -611,7 +665,7 @@ with a unique version number.
611
665
 
612
666
  A list of features to enable in the Pact Broker for beta testing before public release.
613
667
 
614
- **YAML configuration key name:** `features`<br/>
615
668
  **Environment variable name:** `PACT_BROKER_FEATURES`<br/>
669
+ **YAML configuration key name:** `features`<br/>
616
670
  **Format:** A space separated list.<br/>
617
671
 
data/lib/db.rb CHANGED
@@ -38,14 +38,8 @@ module DB
38
38
  con.extension(:connection_validator)
39
39
  con.extension(:pagination)
40
40
  con.extension(:statement_timeout)
41
+ con.extension(:any_not_empty)
41
42
  #con.extension(:caller_logging)
42
- con.extend_datasets do
43
- # rubocop: disable Lint/NestedMethodDefinition
44
- def any?
45
- !empty?
46
- end
47
- # rubocop: enable Lint/NestedMethodDefinition
48
- end
49
43
  con.timezone = :utc
50
44
  con.run("SET sql_mode='STRICT_TRANS_TABLES';") if db_credentials[:adapter].to_s =~ /mysql/
51
45
  con