Revision 8137b14c
Added by Ondřej Ezr about 3 years ago
app/controllers/api/v2/settings_controller.rb | ||
---|---|---|
property :encrypted, [true, false], desc: N_('Is this setting encrypted?')
|
||
property :config_file, String, desc: N_('If this setting needs to be changed in file, it will have the file path.')
|
||
property :select_values, Array, desc: N_('If this setting has list of possible values, this includes the list of the values.')
|
||
property :created_at, Time, desc: N_('DEPRECATED: this will be always application install time and dropped in the future release.')
|
||
property :updated_at, Time, desc: N_('Last updated. NOTE: this will be reset to application install time, when setting is reset to default value.')
|
||
end
|
||
|
||
... | ... | |
|
||
def index
|
||
@settings = resource_scope_for_index.live_descendants
|
||
@settings = @settings.map { |s| Foreman.settings.find(s.name) }
|
||
end
|
||
|
||
api :GET, "/settings/:id/", N_("Show a setting")
|
Also available in: Unified diff
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:ready or not by `ready?` method.