config_skeleton 2.2.0 → 2.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f85f27d60f4dcaf253af5ecff4d6fcc6d851e5b54ad85d3f8cdf2bae4ac4a541
4
- data.tar.gz: fa4ca080415307e4d44e19f12fc5799fc3b8b8f750eda72c7d543491cd37e7fb
3
+ metadata.gz: 3decded320f1627ee52256496c4f2f0ced9cc787b38ca7c5065d0e9ccea7a906
4
+ data.tar.gz: 6eeba5f6a38a171599a8c85d35ab0165c7db4f2b4a2ab2e078a1d23abf9c8f1c
5
5
  SHA512:
6
- metadata.gz: bc6ad4e7c89e473d0902c44b160040da924943d3437310a2edb202a3bab246259f238691bbb81696cc7cf0f0bbe635444dab8add65d0d56790907014aa973293
7
- data.tar.gz: 9659f0fd04bf6d2e89bc2d58ecc82dd741dd6b1f266d7ff36e621fcb0e5c3774e524c7b02187d90c699d7d2163412505bf55501e35c679d25f1f1f2dd590e755
6
+ metadata.gz: b1e51aa4cff67245811b0b9d225387fb0935003382be8680c9106efb17ab6949a5ea4733dad63a071c2bb31912b1e2bb0061723b058aab3bdefb975ec631b565
7
+ data.tar.gz: 9278ad654c21331efa446f8d7212af9717778b1b4ea3efdf71ce30ad484a0fc948ebf7f114c2308b0e5f1036f669f0abab6ba81d1323400d025898fc0310cf38
@@ -4,7 +4,6 @@ on:
4
4
  pull_request:
5
5
  push:
6
6
  branches:
7
- - master
8
7
  - main
9
8
 
10
9
  jobs:
@@ -35,7 +34,7 @@ jobs:
35
34
  run: bundle exec rake test
36
35
 
37
36
  publish:
38
- if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master')
37
+ if: github.event_name == 'push' && github.ref == 'refs/heads/main'
39
38
  needs: build
40
39
  runs-on: ubuntu-latest
41
40
 
@@ -43,7 +42,7 @@ jobs:
43
42
  - uses: actions/checkout@v2
44
43
 
45
44
  - name: Release Gem
46
- uses: discourse/publish-rubygems-action@v2-beta
45
+ uses: discourse/publish-rubygems-action@v3
47
46
  env:
48
47
  RUBYGEMS_API_KEY: ${{ secrets.RUBYGEMS_API_KEY }}
49
48
  GIT_EMAIL: team@discourse.org
data/README.md CHANGED
@@ -24,6 +24,9 @@ presumably know what to do already.
24
24
 
25
25
  # Usage
26
26
 
27
+ A single execution of configuration generation can be performed by specifying
28
+ the `SERVICE_NAME_CONFIG_ONESHOT=true` environment variable.
29
+
27
30
  All of the documentation is provided in the [ConfigSkeleton class](https://rubydoc.info/gems/config_skeleton/ConfigSkeleton).
28
31
 
29
32
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = "config_skeleton"
5
- s.version = "2.2.0"
5
+ s.version = "2.3.0"
6
6
 
7
7
  s.platform = Gem::Platform::RUBY
8
8
  s.summary = "Dynamically generate configs and reload servers"
@@ -145,6 +145,7 @@ end
145
145
  #
146
146
  class ConfigSkeleton
147
147
  include ServiceSkeleton
148
+
148
149
  # All ConfigSkeleton-related errors will be subclasses of this.
149
150
  class Error < StandardError; end
150
151
 
@@ -164,6 +165,8 @@ class ConfigSkeleton
164
165
  end
165
166
 
166
167
  def self.inherited(klass)
168
+ klass.boolean "#{klass.service_name.upcase}_CONFIG_ONESHOT".to_sym, default: false
169
+
167
170
  klass.gauge :"#{klass.service_name}_config_ok", docstring: "Whether the last config change was accepted by the server"
168
171
  klass.gauge :"#{klass.service_name}_generation_ok", docstring: "Whether the last config generation completed without error"
169
172
  klass.gauge :"#{klass.service_name}_last_generation_timestamp", docstring: "When the last config generation run was made"
@@ -242,6 +245,11 @@ class ConfigSkeleton
242
245
 
243
246
  write_initial_config
244
247
 
248
+ if config.config_oneshot
249
+ logger.info(logloc) { "Oneshot run specified - exiting" }
250
+ Process.kill("TERM", $PID)
251
+ end
252
+
245
253
  watch(*self.class.watches)
246
254
 
247
255
  logger.debug(logloc) { "notifier fd is #{notifier.to_io.inspect}" }
@@ -339,7 +347,7 @@ class ConfigSkeleton
339
347
  # @return [void]
340
348
  #
341
349
  def write_initial_config
342
- if File.exists?(config_file)
350
+ if File.exist?(config_file)
343
351
  logger.info(logloc) { "Triggering a config regen on startup to ensure config is up-to-date" }
344
352
  regenerate_config
345
353
  else
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: config_skeleton
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.0
4
+ version: 2.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matt Palmer
8
8
  - Discourse Team
9
- autorequire:
9
+ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2022-06-20 00:00:00.000000000 Z
12
+ date: 2023-12-04 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: diffy
@@ -179,7 +179,7 @@ dependencies:
179
179
  - - ">="
180
180
  - !ruby/object:Gem::Version
181
181
  version: '0'
182
- description:
182
+ description:
183
183
  email:
184
184
  - matt.palmer@discourse.org
185
185
  - team@discourse.org
@@ -201,7 +201,7 @@ files:
201
201
  homepage: https://github.com/discourse/config_skeleton
202
202
  licenses: []
203
203
  metadata: {}
204
- post_install_message:
204
+ post_install_message:
205
205
  rdoc_options: []
206
206
  require_paths:
207
207
  - lib
@@ -216,8 +216,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
216
216
  - !ruby/object:Gem::Version
217
217
  version: '0'
218
218
  requirements: []
219
- rubygems_version: 3.1.6
220
- signing_key:
219
+ rubygems_version: 3.4.10
220
+ signing_key:
221
221
  specification_version: 4
222
222
  summary: Dynamically generate configs and reload servers
223
223
  test_files: []