Allow Sentry client-side DSN to be passed on gitlab.yml

parent 43648e5e
...@@ -196,7 +196,7 @@ module ApplicationSettingImplementation ...@@ -196,7 +196,7 @@ module ApplicationSettingImplementation
end end
def clientside_sentry_dsn def clientside_sentry_dsn
Gitlab.config.sentry.dsn || read_attribute(:clientside_sentry_dsn) Gitlab.config.sentry.clientside_dsn || read_attribute(:clientside_sentry_dsn)
end end
def performance_bar_allowed_group def performance_bar_allowed_group
......
...@@ -5,7 +5,6 @@ ...@@ -5,7 +5,6 @@
%strong %strong
NOTE: NOTE:
These settings will be removed from the UI in a GitLab 12.0 release and made available within gitlab.yml. These settings will be removed from the UI in a GitLab 12.0 release and made available within gitlab.yml.
The specific client side DSN setting is already handled as a component from a Sentry perspective and will be removed.
In addition, you will be able to define a Sentry Environment to differentiate between multiple deployments. For example, development, staging, and production. In addition, you will be able to define a Sentry Environment to differentiate between multiple deployments. For example, development, staging, and production.
%fieldset %fieldset
......
...@@ -320,6 +320,7 @@ production: &base ...@@ -320,6 +320,7 @@ production: &base
sentry: sentry:
# enabled: false # enabled: false
# dsn: https://<key>@sentry.io/<project> # dsn: https://<key>@sentry.io/<project>
# clientside_dsn: https://<key>@sentry.io/<project>
# environment: 'production' # e.g. development, staging, production # environment: 'production' # e.g. development, staging, production
# #
......
...@@ -224,6 +224,7 @@ Settings['sentry'] ||= Settingslogic.new({}) ...@@ -224,6 +224,7 @@ Settings['sentry'] ||= Settingslogic.new({})
Settings.sentry['enabled'] ||= false Settings.sentry['enabled'] ||= false
Settings.sentry['dsn'] ||= nil Settings.sentry['dsn'] ||= nil
Settings.sentry['environment'] ||= nil Settings.sentry['environment'] ||= nil
Settings.sentry['clientside_dsn'] ||= nil
# #
# Pages # Pages
......
...@@ -260,6 +260,7 @@ RSpec.shared_examples 'application settings examples' do ...@@ -260,6 +260,7 @@ RSpec.shared_examples 'application settings examples' do
allow(Gitlab.config.sentry).to receive(:enabled).and_return(false) allow(Gitlab.config.sentry).to receive(:enabled).and_return(false)
allow(Gitlab.config.sentry).to receive(:dsn).and_return(nil) allow(Gitlab.config.sentry).to receive(:dsn).and_return(nil)
allow(Gitlab.config.sentry).to receive(:clientside_dsn).and_return(nil)
expect(setting.sentry_enabled).to eq true expect(setting.sentry_enabled).to eq true
expect(setting.sentry_dsn).to eq 'https://b44a0828b72421a6d8e99efd68d44fa8@example.com/40' expect(setting.sentry_dsn).to eq 'https://b44a0828b72421a6d8e99efd68d44fa8@example.com/40'
...@@ -277,12 +278,13 @@ RSpec.shared_examples 'application settings examples' do ...@@ -277,12 +278,13 @@ RSpec.shared_examples 'application settings examples' do
allow(Gitlab.config.sentry).to receive(:enabled).and_return(true) allow(Gitlab.config.sentry).to receive(:enabled).and_return(true)
allow(Gitlab.config.sentry).to receive(:dsn).and_return('https://b44a0828b72421a6d8e99efd68d44fa8@example.com/42') allow(Gitlab.config.sentry).to receive(:dsn).and_return('https://b44a0828b72421a6d8e99efd68d44fa8@example.com/42')
allow(Gitlab.config.sentry).to receive(:clientside_dsn).and_return('https://b44a0828b72421a6d8e99efd68d44fa8@example.com/43')
expect(setting).not_to receive(:read_attribute) expect(setting).not_to receive(:read_attribute)
expect(setting.sentry_enabled).to eq true expect(setting.sentry_enabled).to eq true
expect(setting.sentry_dsn).to eq 'https://b44a0828b72421a6d8e99efd68d44fa8@example.com/42' expect(setting.sentry_dsn).to eq 'https://b44a0828b72421a6d8e99efd68d44fa8@example.com/42'
expect(setting.clientside_sentry_enabled).to eq true expect(setting.clientside_sentry_enabled).to eq true
expect(setting.clientside_sentry_dsn). to eq 'https://b44a0828b72421a6d8e99efd68d44fa8@example.com/42' expect(setting.clientside_sentry_dsn). to eq 'https://b44a0828b72421a6d8e99efd68d44fa8@example.com/43'
end end
end end
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment