govuk_app_config 2.10.0 → 3.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/dependabot.yml +12 -0
- data/CHANGELOG.md +20 -0
- data/govuk_app_config.gemspec +3 -3
- data/lib/govuk_app_config/govuk_content_security_policy.rb +7 -1
- data/lib/govuk_app_config/govuk_error/govuk_data_sync.rb +1 -7
- data/lib/govuk_app_config/govuk_healthcheck.rb +3 -6
- data/lib/govuk_app_config/version.rb +1 -1
- metadata +8 -11
- data/lib/govuk_app_config/govuk_healthcheck/sidekiq_queue_check.rb +0 -62
- data/lib/govuk_app_config/govuk_healthcheck/sidekiq_queue_latency_check.rb +0 -13
- data/lib/govuk_app_config/govuk_healthcheck/sidekiq_retry_size_check.rb +0 -11
- data/lib/govuk_app_config/govuk_healthcheck/threshold_check.rb +0 -50
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 4ef48ff1d4edbc117dba4f4d8b09b862dacdc5faa06f879c9094e695d29025df
|
|
4
|
+
data.tar.gz: e6465d32e6522637f3a7cdd5681c3286bf3f1fd96657099e3e28ce0e716468fa
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: dd241443a0a59323c2210c67fb04268bd7a662cff61c7eef3580bcde200efd6d38d7efa2bfb22b7642761fd1f929f2e8a4259fe12af8692338f69ce024a9cd15
|
|
7
|
+
data.tar.gz: 8470470f8cf108e25155b6eca6c64f82a9f79b601c22889399bfe71ce87cc39bb3e80a6efda7d30432121766721143329cc5271c591dc75ec36e495687d06a65
|
data/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,23 @@
|
|
|
1
|
+
# 3.3.0
|
|
2
|
+
|
|
3
|
+
- Revert the `should_capture`/`before_send` consolidation introduced in 3.1.0. This fixes the `data_sync_excluded_exceptions` behaviour that has been broken since v3.1.0. ([#211](https://github.com/alphagov/govuk_app_config/pull/211))
|
|
4
|
+
|
|
5
|
+
# 3.2.0
|
|
6
|
+
|
|
7
|
+
- Add Speedcurve's LUX to connect-src policy ([#206](https://github.com/alphagov/govuk_app_config/pull/206))
|
|
8
|
+
|
|
9
|
+
# 3.1.1
|
|
10
|
+
|
|
11
|
+
- Fix the new before_send behaviour & tests, and add documentation ([#197](https://github.com/alphagov/govuk_app_config/pull/197))
|
|
12
|
+
|
|
13
|
+
# 3.1.0
|
|
14
|
+
|
|
15
|
+
- Remove support for `should_capture` callbacks in favour of `before_send` ([#196](https://github.com/alphagov/govuk_app_config/pull/196))
|
|
16
|
+
|
|
17
|
+
# 3.0.0
|
|
18
|
+
|
|
19
|
+
* BREAKING: Implement RFC 141 - remove unsuitable healthchecks and return a 500 on healthcheck failure ([#193](https://github.com/alphagov/govuk_app_config/pull/193))
|
|
20
|
+
|
|
1
21
|
# 2.10.0
|
|
2
22
|
* Allow LUX domain on img-src policy ([#191](https://github.com/alphagov/govuk_app_config/pull/191))
|
|
3
23
|
|
data/govuk_app_config.gemspec
CHANGED
|
@@ -13,9 +13,9 @@ Gem::Specification.new do |spec|
|
|
|
13
13
|
spec.homepage = "https://github.com/alphagov/govuk_app_config"
|
|
14
14
|
spec.license = "MIT"
|
|
15
15
|
|
|
16
|
-
spec.
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
spec.required_ruby_version = ">= 2.6"
|
|
17
|
+
|
|
18
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
|
19
19
|
spec.bindir = "exe"
|
|
20
20
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
|
21
21
|
spec.require_paths = %w[lib]
|
|
@@ -78,7 +78,13 @@ module GovukContentSecurityPolicy
|
|
|
78
78
|
# Allow JSON call to klick2contact - HMPO web chat provider
|
|
79
79
|
"gov.klick2contact.com",
|
|
80
80
|
# Allow connecting to Verify to check whether the user is logged in
|
|
81
|
-
"www.signin.service.gov.uk"
|
|
81
|
+
"www.signin.service.gov.uk",
|
|
82
|
+
# Allow connection to Speedcurve's CDN for LUX - used for
|
|
83
|
+
# real user metrics on GOV.UK. This loads using an image
|
|
84
|
+
# (see image policy), but returns a JavaScript file -
|
|
85
|
+
# which is why this has to be added to the `connect-src`
|
|
86
|
+
# policy as well.
|
|
87
|
+
"lux.speedcurve.com"
|
|
82
88
|
|
|
83
89
|
# Disallow all <object>, <embed>, and <applet> elements
|
|
84
90
|
#
|
|
@@ -3,14 +3,8 @@ require "time"
|
|
|
3
3
|
module GovukError
|
|
4
4
|
class GovukDataSync
|
|
5
5
|
class MalformedDataSyncPeriod < RuntimeError
|
|
6
|
-
attr_reader :invalid_value
|
|
7
|
-
|
|
8
6
|
def initialize(invalid_value)
|
|
9
|
-
|
|
10
|
-
end
|
|
11
|
-
|
|
12
|
-
def message
|
|
13
|
-
"\"#{invalid_value}\" is not a valid value (should be of form '22:00-03:00')."
|
|
7
|
+
super("\"#{invalid_value}\" is not a valid value (should be of form '22:00-03:00').")
|
|
14
8
|
end
|
|
15
9
|
end
|
|
16
10
|
|
|
@@ -4,19 +4,16 @@ require "govuk_app_config/govuk_healthcheck/mongoid"
|
|
|
4
4
|
require "govuk_app_config/govuk_healthcheck/rails_cache"
|
|
5
5
|
require "govuk_app_config/govuk_healthcheck/redis"
|
|
6
6
|
require "govuk_app_config/govuk_healthcheck/sidekiq_redis"
|
|
7
|
-
require "govuk_app_config/govuk_healthcheck/threshold_check"
|
|
8
|
-
require "govuk_app_config/govuk_healthcheck/sidekiq_queue_check"
|
|
9
|
-
require "govuk_app_config/govuk_healthcheck/sidekiq_queue_latency_check"
|
|
10
|
-
require "govuk_app_config/govuk_healthcheck/sidekiq_retry_size_check"
|
|
11
7
|
require "json"
|
|
12
8
|
|
|
13
9
|
module GovukHealthcheck
|
|
14
10
|
def self.rack_response(*checks)
|
|
15
11
|
proc do
|
|
12
|
+
checkup = healthcheck(checks)
|
|
16
13
|
[
|
|
17
|
-
200,
|
|
14
|
+
checkup[:status] == :ok ? 200 : 500,
|
|
18
15
|
{ "Content-Type" => "application/json" },
|
|
19
|
-
[JSON.dump(
|
|
16
|
+
[JSON.dump(checkup)],
|
|
20
17
|
]
|
|
21
18
|
end
|
|
22
19
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: govuk_app_config
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version:
|
|
4
|
+
version: 3.3.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- GOV.UK Dev
|
|
8
|
-
autorequire:
|
|
8
|
+
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2021-
|
|
11
|
+
date: 2021-07-02 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: logstasher
|
|
@@ -211,6 +211,7 @@ executables: []
|
|
|
211
211
|
extensions: []
|
|
212
212
|
extra_rdoc_files: []
|
|
213
213
|
files:
|
|
214
|
+
- ".github/dependabot.yml"
|
|
214
215
|
- ".gitignore"
|
|
215
216
|
- ".rspec"
|
|
216
217
|
- ".rubocop.yml"
|
|
@@ -237,11 +238,7 @@ files:
|
|
|
237
238
|
- lib/govuk_app_config/govuk_healthcheck/mongoid.rb
|
|
238
239
|
- lib/govuk_app_config/govuk_healthcheck/rails_cache.rb
|
|
239
240
|
- lib/govuk_app_config/govuk_healthcheck/redis.rb
|
|
240
|
-
- lib/govuk_app_config/govuk_healthcheck/sidekiq_queue_check.rb
|
|
241
|
-
- lib/govuk_app_config/govuk_healthcheck/sidekiq_queue_latency_check.rb
|
|
242
241
|
- lib/govuk_app_config/govuk_healthcheck/sidekiq_redis.rb
|
|
243
|
-
- lib/govuk_app_config/govuk_healthcheck/sidekiq_retry_size_check.rb
|
|
244
|
-
- lib/govuk_app_config/govuk_healthcheck/threshold_check.rb
|
|
245
242
|
- lib/govuk_app_config/govuk_i18n.rb
|
|
246
243
|
- lib/govuk_app_config/govuk_logging.rb
|
|
247
244
|
- lib/govuk_app_config/govuk_statsd.rb
|
|
@@ -253,7 +250,7 @@ homepage: https://github.com/alphagov/govuk_app_config
|
|
|
253
250
|
licenses:
|
|
254
251
|
- MIT
|
|
255
252
|
metadata: {}
|
|
256
|
-
post_install_message:
|
|
253
|
+
post_install_message:
|
|
257
254
|
rdoc_options: []
|
|
258
255
|
require_paths:
|
|
259
256
|
- lib
|
|
@@ -261,15 +258,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
261
258
|
requirements:
|
|
262
259
|
- - ">="
|
|
263
260
|
- !ruby/object:Gem::Version
|
|
264
|
-
version: '
|
|
261
|
+
version: '2.6'
|
|
265
262
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
266
263
|
requirements:
|
|
267
264
|
- - ">="
|
|
268
265
|
- !ruby/object:Gem::Version
|
|
269
266
|
version: '0'
|
|
270
267
|
requirements: []
|
|
271
|
-
rubygems_version: 3.
|
|
272
|
-
signing_key:
|
|
268
|
+
rubygems_version: 3.0.3
|
|
269
|
+
signing_key:
|
|
273
270
|
specification_version: 4
|
|
274
271
|
summary: Base configuration for GOV.UK applications
|
|
275
272
|
test_files: []
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
module GovukHealthcheck
|
|
2
|
-
class SidekiqQueueCheck
|
|
3
|
-
def status
|
|
4
|
-
queues.each do |name, value|
|
|
5
|
-
if value >= critical_threshold(queue: name)
|
|
6
|
-
return :critical
|
|
7
|
-
elsif value >= warning_threshold(queue: name)
|
|
8
|
-
return :warning
|
|
9
|
-
end
|
|
10
|
-
end
|
|
11
|
-
|
|
12
|
-
:ok
|
|
13
|
-
end
|
|
14
|
-
|
|
15
|
-
def message
|
|
16
|
-
messages = queues.map do |name, value|
|
|
17
|
-
critical = critical_threshold(queue: name)
|
|
18
|
-
warning = warning_threshold(queue: name)
|
|
19
|
-
|
|
20
|
-
if value >= critical
|
|
21
|
-
"#{name} (#{value}) is above the critical threshold (#{critical})"
|
|
22
|
-
elsif value >= warning
|
|
23
|
-
"#{name} (#{value}) is above the warning threshold (#{warning})"
|
|
24
|
-
end
|
|
25
|
-
end
|
|
26
|
-
|
|
27
|
-
messages = messages.compact
|
|
28
|
-
|
|
29
|
-
if messages.empty?
|
|
30
|
-
"all queues are below the critical and warning thresholds"
|
|
31
|
-
else
|
|
32
|
-
messages.join("\n")
|
|
33
|
-
end
|
|
34
|
-
end
|
|
35
|
-
|
|
36
|
-
def details
|
|
37
|
-
{
|
|
38
|
-
queues: queues.each_with_object({}) do |(name, value), hash|
|
|
39
|
-
hash[name] = {
|
|
40
|
-
value: value,
|
|
41
|
-
thresholds: {
|
|
42
|
-
critical: critical_threshold(queue: name),
|
|
43
|
-
warning: warning_threshold(queue: name),
|
|
44
|
-
}.reject { |_, val| val.to_f.infinite? || val.to_f.nan? },
|
|
45
|
-
}
|
|
46
|
-
end,
|
|
47
|
-
}
|
|
48
|
-
end
|
|
49
|
-
|
|
50
|
-
def queues
|
|
51
|
-
raise "This method must be overriden to be a hash of queue names and data."
|
|
52
|
-
end
|
|
53
|
-
|
|
54
|
-
def critical_threshold(queue:) # rubocop:disable Lint/UnusedMethodArgument
|
|
55
|
-
raise "This method must be overriden to be the critical threshold."
|
|
56
|
-
end
|
|
57
|
-
|
|
58
|
-
def warning_threshold(queue:) # rubocop:disable Lint/UnusedMethodArgument
|
|
59
|
-
raise "This method must be overriden to be the warning threshold."
|
|
60
|
-
end
|
|
61
|
-
end
|
|
62
|
-
end
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
module GovukHealthcheck
|
|
2
|
-
class SidekiqQueueLatencyCheck < SidekiqQueueCheck
|
|
3
|
-
def name
|
|
4
|
-
:sidekiq_queue_latency
|
|
5
|
-
end
|
|
6
|
-
|
|
7
|
-
def queues
|
|
8
|
-
@queues ||= Sidekiq::Stats.new.queues.keys.each_with_object({}) do |name, hash|
|
|
9
|
-
hash[name] = Sidekiq::Queue.new(name).latency
|
|
10
|
-
end
|
|
11
|
-
end
|
|
12
|
-
end
|
|
13
|
-
end
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
module GovukHealthcheck
|
|
2
|
-
class ThresholdCheck
|
|
3
|
-
def status
|
|
4
|
-
if value >= critical_threshold
|
|
5
|
-
:critical
|
|
6
|
-
elsif value >= warning_threshold
|
|
7
|
-
:warning
|
|
8
|
-
else
|
|
9
|
-
:ok
|
|
10
|
-
end
|
|
11
|
-
end
|
|
12
|
-
|
|
13
|
-
def message
|
|
14
|
-
if value >= critical_threshold
|
|
15
|
-
"#{value} is above the critical threshold (#{critical_threshold})"
|
|
16
|
-
elsif value >= warning_threshold
|
|
17
|
-
"#{value} is above the warning threshold (#{warning_threshold})"
|
|
18
|
-
else
|
|
19
|
-
"#{value} is below the critical and warning thresholds"
|
|
20
|
-
end
|
|
21
|
-
end
|
|
22
|
-
|
|
23
|
-
def details
|
|
24
|
-
{
|
|
25
|
-
value: value,
|
|
26
|
-
total: total,
|
|
27
|
-
thresholds: {
|
|
28
|
-
critical: critical_threshold,
|
|
29
|
-
warning: warning_threshold,
|
|
30
|
-
},
|
|
31
|
-
}
|
|
32
|
-
end
|
|
33
|
-
|
|
34
|
-
def value
|
|
35
|
-
raise "This method must be overridden to be the check value."
|
|
36
|
-
end
|
|
37
|
-
|
|
38
|
-
def total
|
|
39
|
-
nil # This method can be overriden to provide the total for the check.
|
|
40
|
-
end
|
|
41
|
-
|
|
42
|
-
def critical_threshold
|
|
43
|
-
raise "This method must be overriden to be the critical threshold."
|
|
44
|
-
end
|
|
45
|
-
|
|
46
|
-
def warning_threshold
|
|
47
|
-
raise "This method must be overriden to be the warning threshold."
|
|
48
|
-
end
|
|
49
|
-
end
|
|
50
|
-
end
|