From 85e7164ca1d3322321604b085bc9e2d89eccb163 Mon Sep 17 00:00:00 2001 From: Beth Skurrie Date: Wed, 3 Oct 2018 14:15:23 +1000 Subject: [PATCH] feat: allow disable_ssl_verification to be configured via environment variable https://github.com/pact-foundation/pact_broker/issues/240 --- README.md | 1 + pact_broker/config.ru | 2 +- pact_broker/docker_configuration.rb | 4 ++++ 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 83f9c4f5..236865c9 100644 --- a/README.md +++ b/README.md @@ -71,6 +71,7 @@ Set the environment variable `PACT_BROKER_LOG_LEVEL` to one of `DEBUG`, `INFO`, * PACT_BROKER_BASE_EQUALITY_ONLY_ON_CONTENT_THAT_AFFECTS_VERIFICATION_RESULTS - `true` by default, may be set to `false`. * PACT_BROKER_ORDER_VERSIONS_BY_DATE - `true` by default, may be set to `false`. +* PACT_DISABLE_SSL_VERIFICATION - `false` by default, may be set to `true`. ## General Pact Broker configuration and usage diff --git a/pact_broker/config.ru b/pact_broker/config.ru index 474d686f..31db4d57 100644 --- a/pact_broker/config.ru +++ b/pact_broker/config.ru @@ -18,6 +18,7 @@ app = PactBroker::App.new do | config | config.webhook_scheme_whitelist = dc.webhook_scheme_whitelist config.base_equality_only_on_content_that_affects_verification_results = dc.base_equality_only_on_content_that_affects_verification_results config.order_versions_by_date = dc.order_versions_by_date + config.disable_ssl_verification = dc.disable_ssl_verification end PactBroker.configuration.load_from_database! @@ -33,7 +34,6 @@ basic_auth_read_only_password = ENV.fetch('PACT_BROKER_BASIC_AUTH_READ_ONLY_PASS use_basic_auth = basic_auth_username != '' && basic_auth_password != '' allow_public_access_to_heartbeat = ENV.fetch('PACT_BROKER_PUBLIC_HEARTBEAT', '') == 'true' - if use_basic_auth use BasicAuth, basic_auth_username, diff --git a/pact_broker/docker_configuration.rb b/pact_broker/docker_configuration.rb index d3c7b231..c1a53f66 100644 --- a/pact_broker/docker_configuration.rb +++ b/pact_broker/docker_configuration.rb @@ -35,6 +35,10 @@ def base_equality_only_on_content_that_affects_verification_results end end + def disable_ssl_verification + env(:disable_ssl_verification) == 'true' + end + def order_versions_by_date if env_populated?(:order_versions_by_date) env(:order_versions_by_date) == 'true'