govuk_app_config 2.8.1 → 2.9.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9ecfcca9fa13215a2bcc0771733d647f3efbeed1f92d6b2a37da4ee55ca1f279
4
- data.tar.gz: e149048f64bf194cc831a771258e99128afbb038a99007ca52ead1582d482884
3
+ metadata.gz: 6d09073bb18f9c4e5a0ed20ba834f1ea47be67990e987e6a80cf9da330fd2248
4
+ data.tar.gz: 112569bb62b19b56432c3d8b716eca4861d000ed40ea6bd39e076ad2b0101405
5
5
  SHA512:
6
- metadata.gz: 1df4fc870c49679442395ff7b2240bdb8f810f06117b87bcb2adb5dab542f4afca901e09b5292542d0a655c6851092bd2947e77ea0935644a0d7f91c982040df
7
- data.tar.gz: 51172f8ab6ca1fdb4c0093502b230af01a6fcafa989566bd4d811025939d175df17405ec20331b3c8eeff026c18e0a2a03154cb2e19c2186ff03312734a3158b
6
+ metadata.gz: b08e5e7a43f9371715da678d5a0f3c39b1ec3a40698d4742ae76b0317a08d762e8b1ad918ff9894ca88d7d15eea85acafb50e1e5dea86ef9e713f76372234c77
7
+ data.tar.gz: 2f8853b9d47afb13f368ac6ca7ab9bf90f0377d35452d4c450c91ef25393771467e9c9cee91778a071cc6adcd205fad35c8ccd6c17c1ad6417b99b9173a929bb
data/CHANGELOG.md CHANGED
@@ -1,3 +1,23 @@
1
+ # 2.9.1
2
+
3
+ * Fixes bug in GovukI18n introduced in the last version ([##189](https://github.com/alphagov/govuk_app_config/pull/189))
4
+
5
+ # 2.9.0
6
+
7
+ * Add GovukI18n module with custom plural rules ([##187](https://github.com/alphagov/govuk_app_config/pull/187))
8
+
9
+ # 2.8.4
10
+
11
+ * Ensure Redis healthcheck avoids potential race condition ([#185](https://github.com/alphagov/govuk_app_config/pull/185))
12
+
13
+ # 2.8.3
14
+
15
+ * Add new Redis healthcheck and relevant tests ([#183](https://github.com/alphagov/govuk_app_config/pull/183))
16
+
17
+ # 2.8.2
18
+
19
+ * Allow apps to configure the host and protocol for Statsd ([#180](https://github.com/alphagov/govuk_app_config/pull/180))
20
+
1
21
  # 2.8.1
2
22
 
3
23
  * Add `GdsApi::ContentStore::ItemNotFound` to `data_sync_excluded_exceptions` (https://github.com/alphagov/govuk_app_config/pull/178)
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)
@@ -22,7 +22,7 @@ Gem::Specification.new do |spec|
22
22
 
23
23
  spec.add_dependency "logstasher", ">= 1.2.2", "< 2.2.0"
24
24
  spec.add_dependency "sentry-raven", "~> 3.1.1"
25
- spec.add_dependency "statsd-ruby", "~> 1.4.0"
25
+ spec.add_dependency "statsd-ruby", "~> 1.5.0"
26
26
  spec.add_dependency "unicorn", ">= 5.4", "< 5.9"
27
27
 
28
28
  spec.add_development_dependency "byebug"
@@ -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"
@@ -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
@@ -8,7 +8,7 @@ module GovukStatsd
8
8
 
9
9
  def self.client
10
10
  @client ||= begin
11
- statsd_client = ::Statsd.new("localhost")
11
+ statsd_client = ::Statsd.new(ENV["GOVUK_STATSD_HOST"] || "localhost", 8125, ENV["GOVUK_STATSD_PROTOCOL"]&.to_sym || :udp)
12
12
  statsd_client.namespace = ENV["GOVUK_STATSD_PREFIX"].to_s
13
13
  statsd_client
14
14
  end
@@ -1,3 +1,3 @@
1
1
  module GovukAppConfig
2
- VERSION = "2.8.1".freeze
2
+ VERSION = "2.9.1".freeze
3
3
  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.8.1
4
+ version: 2.9.1
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-01-05 00:00:00.000000000 Z
11
+ date: 2021-03-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: logstasher
@@ -50,14 +50,14 @@ dependencies:
50
50
  requirements:
51
51
  - - "~>"
52
52
  - !ruby/object:Gem::Version
53
- version: 1.4.0
53
+ version: 1.5.0
54
54
  type: :runtime
55
55
  prerelease: false
56
56
  version_requirements: !ruby/object:Gem::Requirement
57
57
  requirements:
58
58
  - - "~>"
59
59
  - !ruby/object:Gem::Version
60
- version: 1.4.0
60
+ version: 1.5.0
61
61
  - !ruby/object:Gem::Dependency
62
62
  name: unicorn
63
63
  requirement: !ruby/object:Gem::Requirement
@@ -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