Skip to content

Commit

Permalink
Add glue for emergency setting overrides
Browse files Browse the repository at this point in the history
  • Loading branch information
ClearlyClaire committed Jan 4, 2024
1 parent 5862895 commit 84f8cb9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
4 changes: 3 additions & 1 deletion app/models/form/admin_settings.rb
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,9 @@ class Form::AdminSettings
elsif OVERRIDEN_SETTINGS.include?(key)
public_send(OVERRIDEN_SETTINGS[key])
else
Setting.public_send(key)
# Avoid any of the emergency overrides by not doing
# Setting.public_send(key)
Setting[key.to_s]
end

instance_variable_set(:"@#{key}", stored_value)
Expand Down
6 changes: 6 additions & 0 deletions app/models/setting.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,5 +57,11 @@ def default_settings

RailsSettings::Default.instance
end

Emergency::SettingOverrideAction::ALLOWED_SETTINGS.each_key do |key|
define_method(key) do
Emergency::SettingOverrideAction.overridden_setting(key) || self[key]
end
end
end
end

0 comments on commit 84f8cb9

Please sign in to comment.