-
-
Notifications
You must be signed in to change notification settings - Fork 178
Configuration
Beth Skurrie edited this page May 5, 2017
·
36 revisions
Change them to your desired values in the config.ru
app = PactBroker::App.new do | config |
config.log_dir = File.expand_path("./log")
config.auto_migrate_db = true
config.use_hal_browser = true
config.validate_database_connection_config = true
config.enable_diagnostic_endpoints = true
config.use_case_sensitive_resource_names = true
config.html_pact_renderer = default_html_pact_render
config.version_parser = PactBroker::Versions::ParseSemanticVersion
end
Configure version_parser
with a lambda or an object/class that responds to call. It should accept a string, and return a sortable object if the version is valid, and nil if the version is not valid.
class MyCustomVersionParser
def self.call string_version
....
end
end
PactBroker::App.new do | config |
config.version_parser = MyCustomVersionParser
end
If you want to customise the error messages to indicate what sort of version format is expected, create a yml file with the following:
en:
pact_broker:
errors:
validation:
consumer_version_number_header_invalid: "Custom message"
consumer_version_number_invalid: "Custom message"
# In config.ru, after configuring the Pact Broker app
I18n.config.load_path << "./path/to/your/custom/messages/file.yml"
Available in version 1.18.0.beta.1 and later.
PactBroker::App.new do | config |
config.protect_with_basic_auth :all, {username: 'username', password: 'password'}
end
PactBroker::App.new do | config |
config.protect_with_basic_auth :app, {username: 'username', password: 'password'}
end
PactBroker::App.new do | config |
config.protect_with_basic_auth :app_write, {username: 'username', password: 'password'}
end
PactBroker::App.new do | config |
config.protect_with_basic_auth :app_read, {username: 'username', password: 'password'}
config.protect_with_basic_auth :app, {username: 'anotherusername', password: 'anotherpassword'}
end
PactBroker::App.new do | config |
config.protect_with_basic_auth :app, {username: 'username', password: 'password'}
config.protect_with_basic_auth :app, {username: 'anotherusername', password: 'anotherpassword'}
end