Class: PactBroker::Configuration
- Inherits:
-
Object
- Object
- PactBroker::Configuration
- Defined in:
- lib/pact_broker/configuration.rb
Constant Summary collapse
- SAVABLE_SETTING_NAMES =
[:order_versions_by_date, :use_case_sensitive_resource_names]
Instance Attribute Summary collapse
-
#auto_migrate_db ⇒ Object
Returns the value of attribute auto_migrate_db.
-
#database_connection ⇒ Object
Returns the value of attribute database_connection.
-
#enable_diagnostic_endpoints ⇒ Object
Returns the value of attribute enable_diagnostic_endpoints.
-
#html_pact_renderer ⇒ Object
Returns the value of attribute html_pact_renderer.
-
#log_dir ⇒ Object
Returns the value of attribute log_dir.
- #logger ⇒ Object
-
#order_versions_by_date ⇒ Object
Returns the value of attribute order_versions_by_date.
-
#semver_formats ⇒ Object
Returns the value of attribute semver_formats.
-
#use_case_sensitive_resource_names ⇒ Object
Returns the value of attribute use_case_sensitive_resource_names.
-
#use_hal_browser ⇒ Object
Returns the value of attribute use_hal_browser.
-
#validate_database_connection_config ⇒ Object
Returns the value of attribute validate_database_connection_config.
-
#version_parser ⇒ Object
Returns the value of attribute version_parser.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#auto_migrate_db ⇒ Object
Returns the value of attribute auto_migrate_db.
11 12 13 |
# File 'lib/pact_broker/configuration.rb', line 11 def auto_migrate_db @auto_migrate_db end |
#database_connection ⇒ Object
Returns the value of attribute database_connection.
11 12 13 |
# File 'lib/pact_broker/configuration.rb', line 11 def database_connection @database_connection end |
#enable_diagnostic_endpoints ⇒ Object
Returns the value of attribute enable_diagnostic_endpoints.
12 13 14 |
# File 'lib/pact_broker/configuration.rb', line 12 def enable_diagnostic_endpoints @enable_diagnostic_endpoints end |
#html_pact_renderer ⇒ Object
Returns the value of attribute html_pact_renderer.
11 12 13 |
# File 'lib/pact_broker/configuration.rb', line 11 def html_pact_renderer @html_pact_renderer end |
#log_dir ⇒ Object
Returns the value of attribute log_dir.
11 12 13 |
# File 'lib/pact_broker/configuration.rb', line 11 def log_dir @log_dir end |
#logger ⇒ Object
17 18 19 |
# File 'lib/pact_broker/configuration.rb', line 17 def logger @logger ||= create_logger log_path end |
#order_versions_by_date ⇒ Object
Returns the value of attribute order_versions_by_date.
13 14 15 |
# File 'lib/pact_broker/configuration.rb', line 13 def order_versions_by_date @order_versions_by_date end |
#semver_formats ⇒ Object
Returns the value of attribute semver_formats.
14 15 16 |
# File 'lib/pact_broker/configuration.rb', line 14 def semver_formats @semver_formats end |
#use_case_sensitive_resource_names ⇒ Object
Returns the value of attribute use_case_sensitive_resource_names.
13 14 15 |
# File 'lib/pact_broker/configuration.rb', line 13 def use_case_sensitive_resource_names @use_case_sensitive_resource_names end |
#use_hal_browser ⇒ Object
Returns the value of attribute use_hal_browser.
11 12 13 |
# File 'lib/pact_broker/configuration.rb', line 11 def use_hal_browser @use_hal_browser end |
#validate_database_connection_config ⇒ Object
Returns the value of attribute validate_database_connection_config.
12 13 14 |
# File 'lib/pact_broker/configuration.rb', line 12 def validate_database_connection_config @validate_database_connection_config end |
#version_parser ⇒ Object
Returns the value of attribute version_parser.
12 13 14 |
# File 'lib/pact_broker/configuration.rb', line 12 def version_parser @version_parser end |
Class Method Details
.default_configuration ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/pact_broker/configuration.rb', line 21 def self.default_configuration require 'pact_broker/versions/parse_semantic_version' config = Configuration.new config.log_dir = File.("./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 # Not recommended to set this to true unless there is no way to # consistently extract an orderable object from the consumer application version number. config.order_versions_by_date = false config.semver_formats = ["%M.%m.%p%s%d","%M.%m", "%M"] config end |
.default_html_pact_render ⇒ Object
39 40 41 42 43 44 |
# File 'lib/pact_broker/configuration.rb', line 39 def self.default_html_pact_render lambda { |pact| require 'pact_broker/api/renderers/html_pact_renderer' PactBroker::Api::Renderers::HtmlPactRenderer.call pact } end |
Instance Method Details
#load_from_database! ⇒ Object
52 53 54 55 56 |
# File 'lib/pact_broker/configuration.rb', line 52 def load_from_database! # Can't require a Sequel::Model class before the connection has been set require 'pact_broker/config/load' PactBroker::Config::Load.call(self) end |
#save_to_database ⇒ Object
46 47 48 49 50 |
# File 'lib/pact_broker/configuration.rb', line 46 def save_to_database # Can't require a Sequel::Model class before the connection has been set require 'pact_broker/config/save' PactBroker::Config::Save.call(self, SAVABLE_SETTING_NAMES) end |