mirror of
https://github.com/discourse/discourse.git
synced 2024-11-23 10:59:51 +08:00
FEATURE: blank global settings should not shadow
Due to https://github.com/docker/docker/issues/9298 it is a huge pain to remove ENV vars when composing images, allow us to simply treat "blank" as a ENV var that is not being shadowed. In general we always supply a value to ENV vars we are shadowing.
This commit is contained in:
parent
8944d62aa6
commit
d0dd517f27
|
@ -121,9 +121,11 @@ module SiteSettingExtension
|
|||
# exists it will be used instead of the setting and the setting will be hidden.
|
||||
# Useful for things like API keys on multisite.
|
||||
if opts[:shadowed_by_global] && GlobalSetting.respond_to?(name)
|
||||
hidden_settings << name
|
||||
shadowed_settings << name
|
||||
current_value = GlobalSetting.send(name)
|
||||
if (val = GlobalSetting.send(name)).present?
|
||||
hidden_settings << name
|
||||
shadowed_settings << name
|
||||
current_value = val
|
||||
end
|
||||
end
|
||||
|
||||
if opts[:refresh]
|
||||
|
|
|
@ -447,6 +447,18 @@ describe SiteSettingExtension do
|
|||
end
|
||||
end
|
||||
|
||||
context "with blank global setting" do
|
||||
before do
|
||||
GlobalSetting.stubs(:nada).returns('')
|
||||
settings.setting(:nada, 'nothing', shadowed_by_global: true)
|
||||
settings.refresh!
|
||||
end
|
||||
|
||||
it "should return default cause nothing is set" do
|
||||
expect(settings.nada).to eq('nothing')
|
||||
end
|
||||
end
|
||||
|
||||
context "with global setting" do
|
||||
before do
|
||||
GlobalSetting.stubs(:trout_api_key).returns('purringcat')
|
||||
|
|
Loading…
Reference in New Issue
Block a user