Skip to content

Commit

Permalink
feat: support setting the application base URL using environment vari…
Browse files Browse the repository at this point in the history
…able PACT_BROKER_BASE_URL
  • Loading branch information
bethesque committed Jan 30, 2020
1 parent af359df commit 2c6fc3b
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ Set the environment variable `PACT_BROKER_LOG_LEVEL` to one of `DEBUG`, `INFO`,
## Other environment variables

* PACT_BROKER_PORT - the port that the Pact Broker application runs on. Defaults to 9292.
* PACT_BROKER_BASE_URL - optional. If you find that the URLs generated by the API are using an IP instead of a hostname, you can set this environment variable to force the desired base URL. Must include the port if it's a non-standard one. eg. `https://my-broker:9292`. Is not currently used for links in the UI.
* PACT_BROKER_DISABLE_SSL_VERIFICATION - `false` by default, may be set to `true`.
* 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. Setting this to false is deprecated.
Expand Down
1 change: 1 addition & 0 deletions pact_broker/config.ru
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ app = PactBroker::App.new do | config |
config.logger = $logger
config.database_connection = create_database_connection(config.logger)
config.database_connection.timezone = :utc
config.base_url = dc.base_url
config.webhook_host_whitelist = dc.webhook_host_whitelist
config.webhook_http_method_whitelist = dc.webhook_http_method_whitelist
config.webhook_scheme_whitelist = dc.webhook_scheme_whitelist
Expand Down
4 changes: 4 additions & 0 deletions pact_broker/docker_configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ def order_versions_by_date
end
end

def base_url
env(:base_url)
end

def env name
@env["PACT_BROKER_#{name.to_s.upcase}"]
end
Expand Down

0 comments on commit 2c6fc3b

Please sign in to comment.