Class: PactBroker::Config::RuntimeConfiguration
Class Method Summary
collapse
Instance Method Summary
collapse
included
included
#all_keys_are_number_strings?, #convert_hash_with_number_string_keys_to_array
included
Class Method Details
.getter_and_setter_method_names ⇒ Object
94
95
96
97
98
99
100
101
102
103
|
# File 'lib/pact_broker/config/runtime_configuration.rb', line 94
def self.getter_and_setter_method_names
= [
: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 } + - [:base_url]
end
|
Instance Method Details
#badge_provider_mode=(badge_provider_mode) ⇒ Object
143
144
145
|
# File 'lib/pact_broker/config/runtime_configuration.rb', line 143
def badge_provider_mode= badge_provider_mode
super(badge_provider_mode&.to_sym)
end
|
#base_url ⇒ Object
131
132
133
|
# File 'lib/pact_broker/config/runtime_configuration.rb', line 131
def base_url
raise NotImplementedError
end
|
#base_url=(base_url) ⇒ Object
125
126
127
|
# File 'lib/pact_broker/config/runtime_configuration.rb', line 125
def base_url= base_url
super(value_to_string_array(base_url, "base_url"))
end
|
#base_urls ⇒ Object
139
140
141
|
# File 'lib/pact_broker/config/runtime_configuration.rb', line 139
def base_urls
(super + [*original_base_url]).uniq
end
|
#base_urls=(base_urls) ⇒ Object
135
136
137
|
# File 'lib/pact_broker/config/runtime_configuration.rb', line 135
def base_urls= base_urls
super(value_to_string_array(base_urls, "base_urls"))
end
|
121
122
123
|
# File 'lib/pact_broker/config/runtime_configuration.rb', line 121
def custom_log_formatters= custom_log_formatters
super(custom_log_formatters&.symbolize_keys)
end
|
#features=(features) ⇒ Object
179
180
181
|
# File 'lib/pact_broker/config/runtime_configuration.rb', line 179
def features= features
super(value_to_string_array(features, "features").collect(&:downcase))
end
|
117
118
119
|
# File 'lib/pact_broker/config/runtime_configuration.rb', line 117
def log_format= log_format
super(log_format&.to_sym)
end
|
#log_level=(log_level) ⇒ Object
109
110
111
|
# File 'lib/pact_broker/config/runtime_configuration.rb', line 109
def log_level= log_level
super(log_level&.downcase&.to_sym)
end
|
#log_stream=(log_stream) ⇒ Object
113
114
115
|
# File 'lib/pact_broker/config/runtime_configuration.rb', line 113
def log_stream= log_stream
super(log_stream&.to_sym)
end
|
#main_branch_candidates=(main_branch_candidates) ⇒ Object
175
176
177
|
# File 'lib/pact_broker/config/runtime_configuration.rb', line 175
def main_branch_candidates= main_branch_candidates
super(value_to_string_array(main_branch_candidates, "main_branch_candidates"))
end
|
#original_base_url ⇒ Object
129
|
# File 'lib/pact_broker/config/runtime_configuration.rb', line 129
alias_method :original_base_url, :base_url
|
#raise_validation_error(msg) ⇒ Object
219
220
221
|
# File 'lib/pact_broker/config/runtime_configuration.rb', line 219
def raise_validation_error(msg)
raise PactBroker::ConfigurationError, msg
end
|
151
152
153
|
# File 'lib/pact_broker/config/runtime_configuration.rb', line 151
def semver_formats= semver_formats
super(value_to_string_array(semver_formats, "semver_formats"))
end
|
#set_webhook_attribute_defaults ⇒ Object
223
224
225
226
227
228
229
|
# File 'lib/pact_broker/config/runtime_configuration.rb', line 223
def set_webhook_attribute_defaults
if webhook_certificates.nil?
self.webhook_certificates = []
end
end
|
#validate_logging_attributes! ⇒ Object
208
209
210
211
212
213
214
215
216
217
|
# File 'lib/pact_broker/config/runtime_configuration.rb', line 208
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
147
148
149
|
# File 'lib/pact_broker/config/runtime_configuration.rb', line 147
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
197
198
199
200
201
202
203
204
205
206
|
# File 'lib/pact_broker/config/runtime_configuration.rb', line 197
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.message}). Ignoring.")
nil
end
end.compact
end
|
#webhook_certificates=(webhook_certificates) ⇒ Object
183
184
185
186
187
188
189
190
191
192
193
194
195
|
# File 'lib/pact_broker/config/runtime_configuration.rb', line 183
def webhook_certificates= webhook_certificates
if webhook_certificates.is_a?(Array)
super(webhook_certificates.collect(&:symbolize_keys))
elsif webhook_certificates.is_a?(Hash)
if all_keys_are_number_strings?(webhook_certificates)
super(convert_hash_with_number_string_keys_to_array(webhook_certificates).collect(&:symbolize_keys))
else
raise_validation_error("webhook_certificates must be an array, or a hash where each key is an integer in string format.")
end
elsif !webhook_certificates.nil?
raise_validation_error("webhook_certificates cannot be set using a #{webhook_certificates.class}")
end
end
|
#webhook_host_whitelist=(webhook_host_whitelist) ⇒ Object
171
172
173
|
# File 'lib/pact_broker/config/runtime_configuration.rb', line 171
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
163
164
165
|
# File 'lib/pact_broker/config/runtime_configuration.rb', line 163
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
159
160
161
|
# File 'lib/pact_broker/config/runtime_configuration.rb', line 159
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
155
156
157
|
# File 'lib/pact_broker/config/runtime_configuration.rb', line 155
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
167
168
169
|
# File 'lib/pact_broker/config/runtime_configuration.rb', line 167
def webhook_scheme_whitelist= webhook_scheme_whitelist
super(value_to_string_array(webhook_scheme_whitelist, "webhook_scheme_whitelist"))
end
|