Project

General

Profile

« Previous | Next » 

Revision 8137b14c

Added by Ondřej Ezr about 3 years ago

Fixes #30862 - introduce SettingRegistry (#8002)

SettingRegistry keeps all the setting information as set of SettingPresenters in memory.
This registry should be the public API for accessing setting values and keeps all the information about settings.
That will allow dropping all information except `name` and `value` from database.

The public interface should be:
`Foreman.settings[<name>] => value` with syntactic suggar `Setting[<name>]` proxying to this method.

We load values from database per request and repopulate the values, what is quite fast. This allows us dropping the cache for setting.

Key implementation features:
  • Initialize the registry manually at specific moment and note if the registry is
    ready or not by `ready?` method.
  • Reload values by `Foreman.setting.load_values` before every request
  • Disables validations on Setting default values creation as those come from code and thus should be always valid, also this creation will be dropped in the future
  • added
  • modified
  • copied
  • renamed
  • deleted