FIX: fails loud if default setting is not set

Noted:
- `push_api_secret_key` is set in initializer. Shimed with ''
- `default_theme_key` is set in seeding. Shimed with ''
This commit is contained in:
Erick Guan
2017-08-03 20:19:02 +02:00
parent 506572bf04
commit 1646bc0031
5 changed files with 56 additions and 2 deletions

View File

@@ -13,11 +13,13 @@ class SiteSettings::YamlLoader
# Get default value for the site setting:
value = hash.delete('default')
if value.is_a?(Hash)
raise Discourse::Deprecation, "Site setting per env is no longer supported. Error setting: #{setting_name}"
raise Discourse::Deprecation, "The site setting `#{setting_name}` can no longer be set based on Rails environment. See also `config/environments/<env>.rb`."
elsif value.nil?
raise StandardError, "The site setting `#{setting_name}` is missing default value."
end
if hash['hidden']&.is_a?(Hash)
raise Discourse::Deprecation, "Hidden site setting per env is no longer supported. Error setting: #{setting_name}"
raise Discourse::Deprecation, "The site setting `#{setting_name}`'s hidden property can no longer be set based on Rails environment. It can only be either `true` or `false`."
end
yield category, setting_name, value, hash.deep_symbolize_keys!