govuk_app_config 2.8.2 → 2.10.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +19 -0
- data/README.md +4 -0
- data/lib/govuk_app_config.rb +1 -0
- data/lib/govuk_app_config/govuk_content_security_policy.rb +4 -1
- data/lib/govuk_app_config/govuk_healthcheck.rb +1 -0
- data/lib/govuk_app_config/govuk_healthcheck/redis.rb +25 -0
- data/lib/govuk_app_config/govuk_i18n.rb +38 -0
- data/lib/govuk_app_config/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f98f57ba0b9010154d3aefbc2540acd056d35ef42af9e3b22b00495255f46899
|
4
|
+
data.tar.gz: c5315e4ba1f476e7c0fcb99839ad9e8705a1546e4b48e3246a16e94f6552b383
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cea414c28b13d2b9cb359bade9dd6626eceb9dfd0f76ca79f77b2b8bff9f4807c01858951860e6888f795a32aa50cd2c79cc1ea63f72a01315a6cbd44b49d8cd
|
7
|
+
data.tar.gz: 3ef1e0ea53a489935775c9475cecb5f55585d2cfba0aed30b6a184430ab7fada8e24670150ebfa60043a59a6d750f76aeb913b89f826da2bbe3db68ca524cc7a
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,22 @@
|
|
1
|
+
# 2.10.0
|
2
|
+
* Allow LUX domain on img-src policy ([#191](https://github.com/alphagov/govuk_app_config/pull/191))
|
3
|
+
|
4
|
+
# 2.9.1
|
5
|
+
|
6
|
+
* Fixes bug in GovukI18n introduced in the last version ([#189](https://github.com/alphagov/govuk_app_config/pull/189))
|
7
|
+
|
8
|
+
# 2.9.0
|
9
|
+
|
10
|
+
* Add GovukI18n module with custom plural rules ([#187](https://github.com/alphagov/govuk_app_config/pull/187))
|
11
|
+
|
12
|
+
# 2.8.4
|
13
|
+
|
14
|
+
* Ensure Redis healthcheck avoids potential race condition ([#185](https://github.com/alphagov/govuk_app_config/pull/185))
|
15
|
+
|
16
|
+
# 2.8.3
|
17
|
+
|
18
|
+
* Add new Redis healthcheck and relevant tests ([#183](https://github.com/alphagov/govuk_app_config/pull/183))
|
19
|
+
|
1
20
|
# 2.8.2
|
2
21
|
|
3
22
|
* Allow apps to configure the host and protocol for Statsd ([#180](https://github.com/alphagov/govuk_app_config/pull/180))
|
data/README.md
CHANGED
@@ -162,6 +162,10 @@ app with the following content:
|
|
162
162
|
GovukContentSecurityPolicy.configure
|
163
163
|
```
|
164
164
|
|
165
|
+
## i18n rules
|
166
|
+
|
167
|
+
Some frontend apps support languages that are not defined in the i18n gem. This provides them with our own custom rules for these languages.
|
168
|
+
|
165
169
|
## License
|
166
170
|
|
167
171
|
[MIT License](LICENSE.md)
|
data/lib/govuk_app_config.rb
CHANGED
@@ -3,6 +3,7 @@ require "govuk_app_config/govuk_statsd"
|
|
3
3
|
require "govuk_app_config/govuk_error"
|
4
4
|
require "govuk_app_config/govuk_error/configure"
|
5
5
|
require "govuk_app_config/govuk_healthcheck"
|
6
|
+
require "govuk_app_config/govuk_i18n"
|
6
7
|
# This require is deprecated and should be removed on next major version bump
|
7
8
|
# and should be required by applications directly.
|
8
9
|
require "govuk_app_config/govuk_unicorn"
|
@@ -32,7 +32,10 @@ module GovukContentSecurityPolicy
|
|
32
32
|
*GOVUK_DOMAINS,
|
33
33
|
*GOOGLE_ANALYTICS_DOMAINS, # Tracking pixels
|
34
34
|
# Some content still links to an old domain we used to use
|
35
|
-
"assets.digital.cabinet-office.gov.uk"
|
35
|
+
"assets.digital.cabinet-office.gov.uk",
|
36
|
+
# Allow images to be loaded for Speedcurve's LUX - used for
|
37
|
+
# getting real user metrics on GOV.UK
|
38
|
+
"lux.speedcurve.com"
|
36
39
|
|
37
40
|
# https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/script-src
|
38
41
|
policy.script_src :self,
|
@@ -2,6 +2,7 @@ require "govuk_app_config/govuk_healthcheck/checkup"
|
|
2
2
|
require "govuk_app_config/govuk_healthcheck/active_record"
|
3
3
|
require "govuk_app_config/govuk_healthcheck/mongoid"
|
4
4
|
require "govuk_app_config/govuk_healthcheck/rails_cache"
|
5
|
+
require "govuk_app_config/govuk_healthcheck/redis"
|
5
6
|
require "govuk_app_config/govuk_healthcheck/sidekiq_redis"
|
6
7
|
require "govuk_app_config/govuk_healthcheck/threshold_check"
|
7
8
|
require "govuk_app_config/govuk_healthcheck/sidekiq_queue_check"
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require "securerandom"
|
2
|
+
|
3
|
+
module GovukHealthcheck
|
4
|
+
class Redis
|
5
|
+
def name
|
6
|
+
:redis_connectivity
|
7
|
+
end
|
8
|
+
|
9
|
+
def status
|
10
|
+
client = ::Redis.new
|
11
|
+
|
12
|
+
key = "healthcheck-#{SecureRandom.hex}"
|
13
|
+
|
14
|
+
client.set(key, "val")
|
15
|
+
client.get(key)
|
16
|
+
client.del(key)
|
17
|
+
|
18
|
+
client.close
|
19
|
+
|
20
|
+
GovukHealthcheck::OK
|
21
|
+
rescue StandardError
|
22
|
+
GovukHealthcheck::CRITICAL
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
module GovukI18n
|
2
|
+
def self.plurals
|
3
|
+
{
|
4
|
+
# Dari - this isn't an iso code. Probably should be 'prs' as per ISO 639-3.
|
5
|
+
dr: { i18n: { plural: { keys: %i[one other], rule: ->(n) { n == 1 ? :one : :other } } } },
|
6
|
+
# Latin America and Caribbean Spanish
|
7
|
+
"es-419": { i18n: { plural: { keys: %i[one other], rule: ->(n) { n == 1 ? :one : :other } } } },
|
8
|
+
# Scottish Gaelic
|
9
|
+
gd: { i18n: { plural: { keys: %i[one two few other],
|
10
|
+
rule:
|
11
|
+
lambda do |n|
|
12
|
+
if [1, 11].include?(n)
|
13
|
+
:one
|
14
|
+
elsif [2, 12].include?(n)
|
15
|
+
:two
|
16
|
+
elsif [3, 4, 5, 6, 7, 8, 9, 10, 13, 14, 15, 16, 17, 18, 19].include?(n)
|
17
|
+
:few
|
18
|
+
else
|
19
|
+
:other
|
20
|
+
end
|
21
|
+
end } } },
|
22
|
+
# Armenian
|
23
|
+
hy: { i18n: { plural: { keys: %i[one other], rule: ->(n) { n == 1 ? :one : :other } } } },
|
24
|
+
# Kazakh
|
25
|
+
kk: { i18n: { plural: { keys: %i[one other], rule: ->(n) { n == 1 ? :one : :other } } } },
|
26
|
+
# Punjabi Shahmukhi
|
27
|
+
"pa-pk": { i18n: { plural: { keys: %i[one other], rule: ->(n) { n == 1 ? :one : :other } } } },
|
28
|
+
# Sinhalese
|
29
|
+
si: { i18n: { plural: { keys: %i[one other], rule: ->(n) { n == 1 ? :one : :other } } } },
|
30
|
+
# Uzbek
|
31
|
+
uz: { i18n: { plural: { keys: %i[one other], rule: ->(n) { n == 1 ? :one : :other } } } },
|
32
|
+
# Chinese Hong Kong
|
33
|
+
"zh-hk" => { i18n: { plural: { keys: %i[one other], rule: ->(n) { n == 1 ? :one : :other } } } },
|
34
|
+
# Chinese Taiwan
|
35
|
+
"zh-tw" => { i18n: { plural: { keys: %i[one other], rule: ->(n) { n == 1 ? :one : :other } } } },
|
36
|
+
}
|
37
|
+
end
|
38
|
+
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: 2.
|
4
|
+
version: 2.10.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- GOV.UK Dev
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-03-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: logstasher
|
@@ -236,11 +236,13 @@ files:
|
|
236
236
|
- lib/govuk_app_config/govuk_healthcheck/checkup.rb
|
237
237
|
- lib/govuk_app_config/govuk_healthcheck/mongoid.rb
|
238
238
|
- lib/govuk_app_config/govuk_healthcheck/rails_cache.rb
|
239
|
+
- lib/govuk_app_config/govuk_healthcheck/redis.rb
|
239
240
|
- lib/govuk_app_config/govuk_healthcheck/sidekiq_queue_check.rb
|
240
241
|
- lib/govuk_app_config/govuk_healthcheck/sidekiq_queue_latency_check.rb
|
241
242
|
- lib/govuk_app_config/govuk_healthcheck/sidekiq_redis.rb
|
242
243
|
- lib/govuk_app_config/govuk_healthcheck/sidekiq_retry_size_check.rb
|
243
244
|
- lib/govuk_app_config/govuk_healthcheck/threshold_check.rb
|
245
|
+
- lib/govuk_app_config/govuk_i18n.rb
|
244
246
|
- lib/govuk_app_config/govuk_logging.rb
|
245
247
|
- lib/govuk_app_config/govuk_statsd.rb
|
246
248
|
- lib/govuk_app_config/govuk_unicorn.rb
|