class SmartProxyDynflowCore::Settings
Constants
- DEFAULT_SETTINGS
- PLUGIN_SETTINGS
- PROXY_SETTINGS
Public Class Methods
instance()
click to toggle source
# File lib/smart_proxy_dynflow_core/settings.rb, line 57 def self.instance SmartProxyDynflowCore::SETTINGS end
load_from_proxy(plugin)
click to toggle source
# File lib/smart_proxy_dynflow_core/settings.rb, line 75 def self.load_from_proxy(plugin) plugin_class = if Proxy::VERSION >= '1.16.0' plugin else # DEPRECATION: Remove this branch when dropping support for smart-proxy < 1.16 plugin[:class] end settings = plugin_class.settings.to_h PROXY_SETTINGS.each do |key| SETTINGS[key] = Proxy::SETTINGS[key] end PLUGIN_SETTINGS.each do |key| SETTINGS[key] = settings[key] if settings.key?(key) end SETTINGS.plugins.values.each { |plugin| plugin.load_settings_from_proxy } Settings.loaded! end
load_global_settings(path)
click to toggle source
# File lib/smart_proxy_dynflow_core/settings.rb, line 61 def self.load_global_settings(path) if File.exists? File.join(path) YAML.load_file(path).each do |key, value| SETTINGS[key] = value end end end
load_plugin_settings(path)
click to toggle source
# File lib/smart_proxy_dynflow_core/settings.rb, line 93 def self.load_plugin_settings(path) settings = YAML.load_file(path) name = File.basename(path).gsub(/\.yml$/, '') if SETTINGS.plugins.key? name settings = SETTINGS.plugins[name].to_h.merge(settings) end SETTINGS.plugins[name] = OpenStruct.new settings end
loaded!()
click to toggle source
# File lib/smart_proxy_dynflow_core/settings.rb, line 69 def self.loaded! Settings.instance.loaded = true Log.instance.info 'Settings loaded, reloading logger' Log.reload! end
new(settings = {})
click to toggle source
Calls superclass method
# File lib/smart_proxy_dynflow_core/settings.rb, line 53 def initialize(settings = {}) super(DEFAULT_SETTINGS.merge(settings)) end