Attempted adding separate clientside_sentry settings

This commit is contained in:
Luke "Jared" Bennett 2017-04-28 13:23:34 +01:00
parent ca6cc6014e
commit 284d4f76fe
No known key found for this signature in database
GPG key ID: 402ED51FB5D306C2
10 changed files with 45 additions and 18 deletions

View file

@ -133,6 +133,8 @@ class Admin::ApplicationSettingsController < Admin::ApplicationController
:signup_enabled,
:sentry_dsn,
:sentry_enabled,
:clientside_sentry_dsn,
:clientside_sentry_enabled,
:send_user_confirmation_email,
:shared_runners_enabled,
:shared_runners_text,

View file

@ -7,13 +7,9 @@ module SentryHelper
Gitlab::Sentry.context(current_user)
end
def sentry_dsn_public
sentry_dsn = ApplicationSetting.current.sentry_dsn
return unless sentry_dsn
uri = URI.parse(sentry_dsn)
uri.password = nil
uri.to_s
def clientside_sentry_enabled?
current_application_settings.clientside_sentry_enabled
end
delegate :clientside_sentry_dsn, to: :current_application_settings
end

View file

@ -60,6 +60,10 @@ class ApplicationSetting < ActiveRecord::Base
presence: true,
if: :sentry_enabled
validates :clientside_sentry_dsn,
presence: true,
if: :clientside_sentry_enabled
validates :akismet_api_key,
presence: true,
if: :akismet_enabled

View file

@ -411,6 +411,21 @@
.col-sm-10
= f.text_field :sentry_dsn, class: 'form-control'
.form-group
.col-sm-offset-2.col-sm-10
.checkbox
= f.label :clientside_sentry_enabled do
= f.check_box :clientside_sentry_enabled
Enable Clientside Sentry
.help-block
Sentry can also be used for reporting and logging clientside exceptions.
%a{ href: 'https://sentry.io/for/javascript/', target: '_blank', rel: 'noopener noreferrer' } https://sentry.io/for/javascript/
.form-group
= f.label :sentry_dsn, 'Sentry DSN', class: 'control-label col-sm-2'
.col-sm-10
= f.text_field :sentry_dsn, class: 'form-control'
%fieldset
%legend Repository Storage
.form-group

View file

@ -33,7 +33,7 @@
= webpack_bundle_tag "runtime"
= webpack_bundle_tag "common"
= webpack_bundle_tag "main"
= webpack_bundle_tag "raven" if sentry_enabled?
= webpack_bundle_tag "raven" if clientside_sentry_enabled?
- if content_for?(:page_specific_javascripts)
= yield :page_specific_javascripts

View file

@ -55,6 +55,7 @@ module Gitlab
# - Webhook URLs (:hook)
# - GitLab-shell secret token (:secret_token)
# - Sentry DSN (:sentry_dsn)
# - Clientside Sentry DSN (:clientside_sentry_dsn)
# - Deploy keys (:key)
config.filter_parameters += %i(
authentication_token
@ -71,6 +72,7 @@ module Gitlab
runners_token
secret_token
sentry_dsn
clientside_sentry_dsn
variables
)

View file

@ -11,7 +11,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 20170424142900) do
ActiveRecord::Schema.define(version: 20170426175636) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
@ -63,7 +63,6 @@ ActiveRecord::Schema.define(version: 20170424142900) do
t.boolean "shared_runners_enabled", default: true, null: false
t.integer "max_artifacts_size", default: 100, null: false
t.string "runners_registration_token"
t.integer "max_pages_size", default: 100, null: false
t.boolean "require_two_factor_authentication", default: false
t.integer "two_factor_grace_period", default: 48
t.boolean "metrics_enabled", default: false
@ -112,15 +111,16 @@ ActiveRecord::Schema.define(version: 20170424142900) do
t.boolean "html_emails_enabled", default: true
t.string "plantuml_url"
t.boolean "plantuml_enabled"
t.integer "max_pages_size", default: 100, null: false
t.integer "terminal_max_session_time", default: 0, null: false
t.string "default_artifacts_expire_in", default: "0", null: false
t.integer "unique_ips_limit_per_user"
t.integer "unique_ips_limit_time_window"
t.boolean "unique_ips_limit_enabled", default: false, null: false
t.decimal "polling_interval_multiplier", default: 1.0, null: false
t.integer "cached_markdown_version"
t.boolean "usage_ping_enabled", default: true, null: false
t.string "uuid"
t.integer "cached_markdown_version"
end
create_table "audit_events", force: :cascade do |t|
@ -731,8 +731,8 @@ ActiveRecord::Schema.define(version: 20170424142900) do
t.integer "visibility_level", default: 20, null: false
t.boolean "request_access_enabled", default: false, null: false
t.datetime "deleted_at"
t.text "description_html"
t.boolean "lfs_enabled"
t.text "description_html"
t.integer "parent_id"
t.boolean "require_two_factor_authentication", default: false, null: false
t.integer "two_factor_grace_period", default: 48, null: false
@ -965,9 +965,9 @@ ActiveRecord::Schema.define(version: 20170424142900) do
t.boolean "lfs_enabled"
t.text "description_html"
t.boolean "only_allow_merge_if_all_discussions_are_resolved"
t.integer "auto_cancel_pending_pipelines", default: 0, null: false
t.boolean "printing_merge_request_link_enabled", default: true, null: false
t.string "import_jid"
t.integer "auto_cancel_pending_pipelines", default: 0, null: false
t.integer "cached_markdown_version"
end
@ -1070,7 +1070,6 @@ ActiveRecord::Schema.define(version: 20170424142900) do
t.string "line_code"
t.string "note_type"
t.text "position"
t.string "in_reply_to_discussion_id"
end
add_index "sent_notifications", ["reply_key"], name: "index_sent_notifications_on_reply_key", unique: true, using: :btree
@ -1320,10 +1319,10 @@ ActiveRecord::Schema.define(version: 20170424142900) do
t.string "organization"
t.boolean "authorized_projects_populated"
t.boolean "ghost"
t.date "last_activity_on"
t.boolean "notified_of_own_activity"
t.boolean "require_two_factor_authentication_from_group", default: false, null: false
t.integer "two_factor_grace_period", default: 48, null: false
t.date "last_activity_on"
end
add_index "users", ["admin"], name: "index_users_on_admin", using: :btree

View file

@ -58,6 +58,7 @@ module API
:restricted_visibility_levels,
:send_user_confirmation_email,
:sentry_enabled,
:clientside_sentry_enabled,
:session_expire_delay,
:shared_runners_enabled,
:sidekiq_throttling_enabled,
@ -138,6 +139,10 @@ module API
given sentry_enabled: ->(val) { val } do
requires :sentry_dsn, type: String, desc: 'Sentry Data Source Name'
end
optional :clientside_sentry_enabled, type: Boolean, desc: 'Sentry can also be used for reporting and logging clientside exceptions. https://sentry.io/for/javascript/'
given clientside_sentry_enabled: ->(val) { val } do
requires :clientside_sentry_dsn, type: String, desc: 'Clientside Sentry Data Source Name'
end
optional :repository_storage, type: String, desc: 'Storage paths for new projects'
optional :repository_checks_enabled, type: Boolean, desc: "GitLab will periodically run 'git fsck' in all project and wiki repositories to look for silent disk corruption issues."
optional :koding_enabled, type: Boolean, desc: 'Enable Koding'

View file

@ -89,6 +89,10 @@ module API
given sentry_enabled: ->(val) { val } do
requires :sentry_dsn, type: String, desc: 'Sentry Data Source Name'
end
optional :clientside_sentry_enabled, type: Boolean, desc: 'Sentry can also be used for reporting and logging clientside exceptions. https://sentry.io/for/javascript/'
given clientside_sentry_enabled: ->(val) { val } do
requires :clientside_sentry_dsn, type: String, desc: 'Clientside Sentry Data Source Name'
end
optional :repository_storage, type: String, desc: 'Storage paths for new projects'
optional :repository_checks_enabled, type: Boolean, desc: "GitLab will periodically run 'git fsck' in all project and wiki repositories to look for silent disk corruption issues."
optional :koding_enabled, type: Boolean, desc: 'Enable Koding'
@ -120,7 +124,7 @@ module API
:home_page_url, :after_sign_out_path, :sign_in_text, :help_page_text,
:shared_runners_enabled, :max_artifacts_size, :max_pages_size, :container_registry_token_expire_delay,
:metrics_enabled, :sidekiq_throttling_enabled, :recaptcha_enabled,
:akismet_enabled, :admin_notification_email, :sentry_enabled,
:akismet_enabled, :admin_notification_email, :sentry_enabled, :clientside_sentry_enabled,
:repository_storage, :repository_checks_enabled, :koding_enabled, :plantuml_enabled,
:version_check_enabled, :email_author_in_body, :html_emails_enabled,
:housekeeping_enabled, :terminal_max_session_time

View file

@ -12,7 +12,7 @@ module Gitlab
gon.user_color_scheme = Gitlab::ColorSchemes.for_user(current_user).css_class
gon.katex_css_url = ActionController::Base.helpers.asset_path('katex.css')
gon.katex_js_url = ActionController::Base.helpers.asset_path('katex.js')
gon.sentry_dsn = sentry_dsn_public if sentry_enabled?
gon.sentry_dsn = Gitlab.config.clientside_sentry_dsn if clientside_sentry_enabled?
gon.gitlab_url = Gitlab.config.gitlab.url
gon.is_production = Rails.env.production?