mirror of
https://github.com/discourse/discourse.git
synced 2024-11-27 04:33:40 +08:00
42015fe8b2
These were deprecated ~4 years ago. No need to keep the errors anymore.
31 lines
769 B
Ruby
31 lines
769 B
Ruby
# frozen_string_literal: true
|
|
|
|
module SiteSettings; end
|
|
|
|
class SiteSettings::YamlLoader
|
|
def initialize(file)
|
|
@file = file
|
|
end
|
|
|
|
def load
|
|
yaml = YAML.load_file(@file)
|
|
yaml.each_key do |category|
|
|
yaml[category].each do |setting_name, hash|
|
|
if hash.is_a?(Hash)
|
|
# Get default value for the site setting:
|
|
value = hash.delete('default')
|
|
|
|
if value.nil?
|
|
raise StandardError, "The site setting `#{setting_name}` in '#{@file}' is missing default value."
|
|
end
|
|
|
|
yield category, setting_name, value, hash.deep_symbolize_keys!
|
|
else
|
|
# Simplest case. site_setting_name: 'default value'
|
|
yield category, setting_name, hash, {}
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|