class Photish::Config::Settings
Attributes
runtime_config[R]
Public Class Methods
new(runtime_config)
click to toggle source
# File lib/photish/config/settings.rb, line 4 def initialize(runtime_config) @runtime_config = extract_config(runtime_config) end
Public Instance Methods
config()
click to toggle source
# File lib/photish/config/settings.rb, line 8 def config @config ||= RecursiveOpenStruct.new(prioritized_config) end
version_hash()
click to toggle source
# File lib/photish/config/settings.rb, line 12 def version_hash @version_hash ||= Digest::MD5.hexdigest(sensitive_config.to_json) end
Private Instance Methods
default_config()
click to toggle source
# File lib/photish/config/settings.rb, line 48 def default_config DefaultConfig.new .hash .deep_symbolize_keys end
derived_config()
click to toggle source
# File lib/photish/config/settings.rb, line 37 def derived_config { config_file_location: file_config_instance.path } end
extract_config(hash)
click to toggle source
# File lib/photish/config/settings.rb, line 20 def extract_config(hash) {}.deep_merge(hash) .deep_merge(JSON.parse(hash.fetch('config_override', '{}'))) .deep_symbolize_keys end
file_config()
click to toggle source
# File lib/photish/config/settings.rb, line 43 def file_config file_config_instance.hash .deep_symbolize_keys end
file_config_instance()
click to toggle source
# File lib/photish/config/settings.rb, line 54 def file_config_instance @file_config_instance ||= FileConfig.new(runtime_config[:config_dir]) end
prioritized_config()
click to toggle source
# File lib/photish/config/settings.rb, line 26 def prioritized_config @prioritized_config = {}.deep_merge(default_config) .deep_merge(file_config) .deep_merge(runtime_config) .deep_merge(derived_config) end
sensitive_config()
click to toggle source
# File lib/photish/config/settings.rb, line 33 def sensitive_config prioritized_config.slice(:qualities) end