Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ Inspired by [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

Note: this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.19.2] - 2023-11-28
### Updated
- Updated README to include ProcessSetting lookup best practices when using `targets` in settings.

## [0.19.1] - 2022-12-16
### Fixed
- Fixed a bug in `ProcessSettings::Watchdog` preventing it from raising out of sync errors
Expand Down
28 changes: 20 additions & 8 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
process_settings (0.19.1)
process_settings (0.19.2)
activesupport
json
listen (~> 3.0)
Expand All @@ -10,30 +10,41 @@ PATH
GEM
remote: http://rubygems.org/
specs:
activesupport (7.0.4)
activesupport (7.1.2)
base64
bigdecimal
concurrent-ruby (~> 1.0, >= 1.0.2)
connection_pool (>= 2.2.5)
drb
i18n (>= 1.6, < 2)
minitest (>= 5.1)
mutex_m
tzinfo (~> 2.0)
appraisal (2.4.1)
bundler
rake
thor (>= 0.14.0)
ast (2.4.2)
base64 (0.2.0)
bigdecimal (3.1.4)
bump (0.6.1)
coderay (1.1.3)
concurrent-ruby (1.1.10)
concurrent-ruby (1.2.2)
connection_pool (2.4.1)
diff-lcs (1.5.0)
docile (1.4.0)
ffi (1.15.5)
i18n (1.12.0)
drb (2.2.0)
ruby2_keywords
ffi (1.16.3)
i18n (1.14.1)
concurrent-ruby (~> 1.0)
json (2.6.3)
listen (3.7.1)
listen (3.8.0)
rb-fsevent (~> 0.10, >= 0.10.3)
rb-inotify (~> 0.9, >= 0.9.10)
method_source (1.0.0)
minitest (5.16.3)
minitest (5.20.0)
mutex_m (0.2.0)
parallel (1.22.1)
parser (3.1.1.0)
ast (~> 2.4.1)
Expand Down Expand Up @@ -75,6 +86,7 @@ GEM
ruby-prof-flamegraph (0.3.0)
ruby-prof (~> 0.13)
ruby-progressbar (1.11.0)
ruby2_keywords (0.0.5)
simplecov (0.21.2)
docile (~> 1.1)
simplecov-html (~> 0.11)
Expand All @@ -83,7 +95,7 @@ GEM
simplecov-lcov (0.8.0)
simplecov_json_formatter (0.1.4)
thor (1.2.1)
tzinfo (2.0.5)
tzinfo (2.0.6)
concurrent-ruby (~> 1.0)
unicode-display_width (1.8.0)

Expand Down
30 changes: 30 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,36 @@ This will be applied in any process that has (`service_name == "frontend"` OR `s
### Precedence
The settings YAML files are always combined in alphabetical order by file path. Later settings take precedence over the earlier ones.

Settings are **not** merged, so make sure to review best practices when using targets.

#### Process Setting Lookup Best Practices When Using Targeting

1. In your business logic, lookup process settings as granularly as possible.
1. E.g. Instead of querying `ProcessSettings['cat_calendar_config']` and then getting the `'cats_per_calender_minimum'` key from the resulting hash, do `ProcessSettings['cat_calendar_config', 'cats_per_calendar_minimum']`.
2. If you can't do granular process setting lookups, make sure any files with targets redefine all required keys in the process settings config.

Example for 2: If your business logic is looking up `ProcessSettings['general_calendar_config']` to use the output like a generic hash, you should define target overrides like the `eu_general_calendar_override.yml` example below:

For an example `all.yml` file like this:

```
settings:
general_calendar_config:
turtle_calendar_color: "blue"
parrot_calendar_color: "red"
```

Make sure your target file redefines all required keys like this `eu_general_calendar_override.yml` example:

```
target:
data_silo: eu
settings:
general_calendar_config:
turtle_calendar_color: "yellow"
parrot_calendar_color: "red"
```

### Forked Processes
When using `ProcessSettings` within an environment that is forking threads (like `unicorn` web servers), you can restart the `FileMonitor`
after the fork with `restart_after_fork`.
Expand Down
2 changes: 1 addition & 1 deletion lib/process_settings/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# frozen_string_literal: true

module ProcessSettings
VERSION = '0.19.1'
VERSION = '0.19.2'
end
1 change: 1 addition & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

require 'rspec_junit_formatter'
require 'process_settings'
require 'active_support/core_ext/object/blank'

require 'pry'

Expand Down