Class: PactBroker::Config::RuntimeConfiguration
- Inherits:
-
Anyway::Config
- Object
- Anyway::Config
- PactBroker::Config::RuntimeConfiguration
- Includes:
- RuntimeConfigurationBasicAuthMethods, RuntimeConfigurationCoercionMethods, RuntimeConfigurationDatabaseMethods, RuntimeConfigurationLoggingMethods
- Defined in:
- lib/pact_broker/config/runtime_configuration.rb
Class Method Summary collapse
Instance Method Summary collapse
- #badge_provider_mode=(badge_provider_mode) ⇒ Object
- #base_url ⇒ Object
- #base_url=(base_url) ⇒ Object
- #base_urls ⇒ Object
- #base_urls=(base_urls) ⇒ Object
- #custom_log_formatters=(custom_log_formatters) ⇒ Object
- #features=(features) ⇒ Object
- #log_format=(log_format) ⇒ Object
- #log_level=(log_level) ⇒ Object
- #log_stream=(log_stream) ⇒ Object
- #main_branch_candidates=(main_branch_candidates) ⇒ Object
- #original_base_url ⇒ Object
- #raise_validation_error(msg) ⇒ Object
- #semver_formats=(semver_formats) ⇒ Object
- #validate_logging_attributes! ⇒ Object
- #warning_error_class_names=(warning_error_class_names) ⇒ Object
- #warning_error_classes ⇒ Object
- #webhook_certificates=(webhook_certificates) ⇒ Object
- #webhook_host_whitelist=(webhook_host_whitelist) ⇒ Object
- #webhook_http_code_success=(webhook_http_code_success) ⇒ Object
- #webhook_http_method_whitelist=(webhook_http_method_whitelist) ⇒ Object
- #webhook_retry_schedule=(webhook_retry_schedule) ⇒ Object
- #webhook_scheme_whitelist=(webhook_scheme_whitelist) ⇒ Object
Methods included from RuntimeConfigurationBasicAuthMethods
Methods included from RuntimeConfigurationDatabaseMethods
Methods included from RuntimeConfigurationLoggingMethods
Class Method Details
.getter_and_setter_method_names ⇒ Object
89 90 91 92 93 94 95 96 97 98 |
# File 'lib/pact_broker/config/runtime_configuration.rb', line 89 def self.getter_and_setter_method_names extra_methods = [ :warning_error_classes, :database_configuration, :basic_auth_credentials_provided?, :basic_auth_write_credentials, :basic_auth_read_credentials ] config_attributes + config_attributes.collect{ |k| "#{k}=".to_sym } + extra_methods - [:base_url] end |
Instance Method Details
#badge_provider_mode=(badge_provider_mode) ⇒ Object
138 139 140 |
# File 'lib/pact_broker/config/runtime_configuration.rb', line 138 def badge_provider_mode= badge_provider_mode super(badge_provider_mode&.to_sym) end |
#base_url ⇒ Object
126 127 128 |
# File 'lib/pact_broker/config/runtime_configuration.rb', line 126 def base_url raise NotImplementedError end |
#base_url=(base_url) ⇒ Object
120 121 122 |
# File 'lib/pact_broker/config/runtime_configuration.rb', line 120 def base_url= base_url super(value_to_string_array(base_url, "base_url")) end |
#base_urls ⇒ Object
134 135 136 |
# File 'lib/pact_broker/config/runtime_configuration.rb', line 134 def base_urls (super + [*original_base_url]).uniq end |
#base_urls=(base_urls) ⇒ Object
130 131 132 |
# File 'lib/pact_broker/config/runtime_configuration.rb', line 130 def base_urls= base_urls super(value_to_string_array(base_urls, "base_urls")) end |
#custom_log_formatters=(custom_log_formatters) ⇒ Object
116 117 118 |
# File 'lib/pact_broker/config/runtime_configuration.rb', line 116 def custom_log_formatters= custom_log_formatters super(custom_log_formatters&.symbolize_keys) end |
#features=(features) ⇒ Object
174 175 176 |
# File 'lib/pact_broker/config/runtime_configuration.rb', line 174 def features= features super(value_to_string_array(features, "features").collect(&:downcase)) end |
#log_format=(log_format) ⇒ Object
112 113 114 |
# File 'lib/pact_broker/config/runtime_configuration.rb', line 112 def log_format= log_format super(log_format&.to_sym) end |
#log_level=(log_level) ⇒ Object
104 105 106 |
# File 'lib/pact_broker/config/runtime_configuration.rb', line 104 def log_level= log_level super(log_level&.downcase&.to_sym) end |
#log_stream=(log_stream) ⇒ Object
108 109 110 |
# File 'lib/pact_broker/config/runtime_configuration.rb', line 108 def log_stream= log_stream super(log_stream&.to_sym) end |
#main_branch_candidates=(main_branch_candidates) ⇒ Object
170 171 172 |
# File 'lib/pact_broker/config/runtime_configuration.rb', line 170 def main_branch_candidates= main_branch_candidates super(value_to_string_array(main_branch_candidates, "main_branch_candidates")) end |
#original_base_url ⇒ Object
124 |
# File 'lib/pact_broker/config/runtime_configuration.rb', line 124 alias_method :original_base_url, :base_url |
#raise_validation_error(msg) ⇒ Object
208 209 210 |
# File 'lib/pact_broker/config/runtime_configuration.rb', line 208 def raise_validation_error(msg) raise PactBroker::ConfigurationError, msg end |
#semver_formats=(semver_formats) ⇒ Object
146 147 148 |
# File 'lib/pact_broker/config/runtime_configuration.rb', line 146 def semver_formats= semver_formats super(value_to_string_array(semver_formats, "semver_formats")) end |
#validate_logging_attributes! ⇒ Object
197 198 199 200 201 202 203 204 205 206 |
# File 'lib/pact_broker/config/runtime_configuration.rb', line 197 def validate_logging_attributes! valid_log_streams = [:file, :stdout] unless valid_log_streams.include?(log_stream) raise_validation_error("log_stream must be one of: #{valid_log_streams.join(", ")}") end if log_stream == :file && log_dir.blank? raise_validation_error("Must specify log_dir if log_stream is set to file") end end |
#warning_error_class_names=(warning_error_class_names) ⇒ Object
142 143 144 |
# File 'lib/pact_broker/config/runtime_configuration.rb', line 142 def warning_error_class_names= warning_error_class_names super(value_to_string_array(warning_error_class_names, "warning_error_class_names")) end |
#warning_error_classes ⇒ Object
186 187 188 189 190 191 192 193 194 195 |
# File 'lib/pact_broker/config/runtime_configuration.rb', line 186 def warning_error_classes warning_error_class_names.collect do | class_name | begin Object.const_get(class_name) rescue NameError => e puts("Class #{class_name} couldn't be loaded as a warning error class (#{e.class} - #{e.}). Ignoring.") nil end end.compact end |
#webhook_certificates=(webhook_certificates) ⇒ Object
178 179 180 181 182 183 184 |
# File 'lib/pact_broker/config/runtime_configuration.rb', line 178 def webhook_certificates= webhook_certificates if webhook_certificates.is_a?(Array) super(webhook_certificates.collect(&:symbolize_keys)) elsif !webhook_certificates.nil? raise_validation_error("webhook_certificates must be an array") end end |
#webhook_host_whitelist=(webhook_host_whitelist) ⇒ Object
166 167 168 |
# File 'lib/pact_broker/config/runtime_configuration.rb', line 166 def webhook_host_whitelist= webhook_host_whitelist super(value_to_string_array(webhook_host_whitelist, "webhook_host_whitelist")) end |
#webhook_http_code_success=(webhook_http_code_success) ⇒ Object
158 159 160 |
# File 'lib/pact_broker/config/runtime_configuration.rb', line 158 def webhook_http_code_success= webhook_http_code_success super(value_to_integer_array(webhook_http_code_success, "webhook_http_code_success")) end |
#webhook_http_method_whitelist=(webhook_http_method_whitelist) ⇒ Object
154 155 156 |
# File 'lib/pact_broker/config/runtime_configuration.rb', line 154 def webhook_http_method_whitelist= webhook_http_method_whitelist super(value_to_string_array(webhook_http_method_whitelist, "webhook_http_method_whitelist")) end |
#webhook_retry_schedule=(webhook_retry_schedule) ⇒ Object
150 151 152 |
# File 'lib/pact_broker/config/runtime_configuration.rb', line 150 def webhook_retry_schedule= webhook_retry_schedule super(value_to_integer_array(webhook_retry_schedule, "webhook_retry_schedule")) end |
#webhook_scheme_whitelist=(webhook_scheme_whitelist) ⇒ Object
162 163 164 |
# File 'lib/pact_broker/config/runtime_configuration.rb', line 162 def webhook_scheme_whitelist= webhook_scheme_whitelist super(value_to_string_array(webhook_scheme_whitelist, "webhook_scheme_whitelist")) end |