diff options
author | Oswaldo Ferreira <oswaldo@gitlab.com> | 2017-10-26 21:13:27 +0200 |
---|---|---|
committer | Oswaldo Ferreira <oswaldo@gitlab.com> | 2017-10-26 21:13:27 +0200 |
commit | 7a534231493f7f4220995b3accc92d4d002a6fa5 (patch) | |
tree | 9a4d055bc2b851ffefdd89a41ecc8eb71495c5b0 | |
parent | 9931ef4a8a9fa9544729fe39cb3572d278819c8d (diff) | |
download | gitlab-ce-37698-current-settings-singleton.tar.gz |
WIP: Replace current settings module inclusion by "singleton"37698-current-settings-singleton
80 files changed, 150 insertions, 149 deletions
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 391a0519195..a6f7420fc59 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -2,7 +2,7 @@ require 'gon' require 'fogbugz' class ApplicationController < ActionController::Base - include Gitlab::CurrentSettings + # # include Gitlab::CurrentSettings include Gitlab::GonHelper include GitlabRoutingHelper include PageLayoutHelper diff --git a/app/controllers/concerns/requires_whitelisted_monitoring_client.rb b/app/controllers/concerns/requires_whitelisted_monitoring_client.rb index 0218ac83441..f11554a0f54 100644 --- a/app/controllers/concerns/requires_whitelisted_monitoring_client.rb +++ b/app/controllers/concerns/requires_whitelisted_monitoring_client.rb @@ -1,7 +1,7 @@ module RequiresWhitelistedMonitoringClient extend ActiveSupport::Concern - include Gitlab::CurrentSettings + # # include Gitlab::CurrentSettings included do before_action :validate_ip_whitelisted_or_valid_token! diff --git a/app/controllers/oauth/applications_controller.rb b/app/controllers/oauth/applications_controller.rb index b02e64a132b..cceebd20239 100644 --- a/app/controllers/oauth/applications_controller.rb +++ b/app/controllers/oauth/applications_controller.rb @@ -1,5 +1,5 @@ class Oauth::ApplicationsController < Doorkeeper::ApplicationsController - include Gitlab::CurrentSettings + # # include Gitlab::CurrentSettings include Gitlab::GonHelper include PageLayoutHelper include OauthApplications diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 4754a67450f..5a6e23a9775 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -202,7 +202,7 @@ module ApplicationHelper end def support_url - Gitlab::CurrentSettings.current_application_settings.help_page_support_url.presence || promo_url + '/getting-help/' + Gitlab::CurrentSettings.help_page_support_url.presence || promo_url + '/getting-help/' end def page_filter_path(options = {}) diff --git a/app/helpers/application_settings_helper.rb b/app/helpers/application_settings_helper.rb index 1ee8911bb1a..3712f274aae 100644 --- a/app/helpers/application_settings_helper.rb +++ b/app/helpers/application_settings_helper.rb @@ -1,7 +1,7 @@ module ApplicationSettingsHelper extend self - include Gitlab::CurrentSettings + # include Gitlab::CurrentSettings delegate :gravatar_enabled?, :signup_enabled?, diff --git a/app/helpers/auth_helper.rb b/app/helpers/auth_helper.rb index 66dc0b1e6f7..3a3e47f720e 100644 --- a/app/helpers/auth_helper.rb +++ b/app/helpers/auth_helper.rb @@ -1,5 +1,5 @@ module AuthHelper - include Gitlab::CurrentSettings + # include Gitlab::CurrentSettings PROVIDERS_WITH_ICONS = %w(twitter github gitlab bitbucket google_oauth2 facebook azure_oauth2 authentiq).freeze FORM_BASED_PROVIDERS = [/\Aldap/, 'crowd'].freeze diff --git a/app/helpers/projects_helper.rb b/app/helpers/projects_helper.rb index d085c1a0e57..cb411d1e7a9 100644 --- a/app/helpers/projects_helper.rb +++ b/app/helpers/projects_helper.rb @@ -1,5 +1,5 @@ module ProjectsHelper - include Gitlab::CurrentSettings + # include Gitlab::CurrentSettings def link_to_project(project) link_to [project.namespace.becomes(Namespace), project], title: h(project.name) do diff --git a/app/mailers/abuse_report_mailer.rb b/app/mailers/abuse_report_mailer.rb index d0ce827a595..c84a59a0baa 100644 --- a/app/mailers/abuse_report_mailer.rb +++ b/app/mailers/abuse_report_mailer.rb @@ -1,5 +1,5 @@ class AbuseReportMailer < BaseMailer - include Gitlab::CurrentSettings + # include Gitlab::CurrentSettings def notify(abuse_report_id) return unless deliverable? diff --git a/app/mailers/base_mailer.rb b/app/mailers/base_mailer.rb index 8e99db444d6..1dde4827908 100644 --- a/app/mailers/base_mailer.rb +++ b/app/mailers/base_mailer.rb @@ -1,5 +1,5 @@ class BaseMailer < ActionMailer::Base - include Gitlab::CurrentSettings + # include Gitlab::CurrentSettings around_action :render_with_default_locale diff --git a/app/models/concerns/spammable.rb b/app/models/concerns/spammable.rb index 731d9b9a745..ba9aea112c0 100644 --- a/app/models/concerns/spammable.rb +++ b/app/models/concerns/spammable.rb @@ -28,7 +28,7 @@ module Spammable def submittable_as_spam? if user_agent_detail - user_agent_detail.submittable? && Gitlab::CurrentSettings.current_application_settings.akismet_enabled + user_agent_detail.submittable? && Gitlab::CurrentSettings.akismet_enabled else false end diff --git a/app/models/issue_assignee.rb b/app/models/issue_assignee.rb index 06d760b6a89..b001ef7ac89 100644 --- a/app/models/issue_assignee.rb +++ b/app/models/issue_assignee.rb @@ -1,5 +1,5 @@ class IssueAssignee < ActiveRecord::Base - extend Gitlab::CurrentSettings + # extend Gitlab::CurrentSettings belongs_to :issue belongs_to :assignee, class_name: "User", foreign_key: :user_id diff --git a/app/models/key.rb b/app/models/key.rb index f119b15c737..ffda30e3c3b 100644 --- a/app/models/key.rb +++ b/app/models/key.rb @@ -1,7 +1,7 @@ require 'digest/md5' class Key < ActiveRecord::Base - include Gitlab::CurrentSettings + # include Gitlab::CurrentSettings include Sortable belongs_to :user diff --git a/app/models/namespace.rb b/app/models/namespace.rb index 0601a61a926..1a78a14dcb1 100644 --- a/app/models/namespace.rb +++ b/app/models/namespace.rb @@ -4,7 +4,7 @@ class Namespace < ActiveRecord::Base include CacheMarkdownField include Sortable include Gitlab::ShellAdapter - include Gitlab::CurrentSettings + # include Gitlab::CurrentSettings include Gitlab::VisibilityLevel include Routable include AfterCommitQueue diff --git a/app/models/note.rb b/app/models/note.rb index 8939e590ef1..1ae58a471a9 100644 --- a/app/models/note.rb +++ b/app/models/note.rb @@ -3,7 +3,7 @@ # A note of this type is never resolvable. class Note < ActiveRecord::Base extend ActiveModel::Naming - include Gitlab::CurrentSettings + # include Gitlab::CurrentSettings include Participable include Mentionable include Awardable diff --git a/app/models/project.rb b/app/models/project.rb index 4689b588906..c3191336024 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -4,7 +4,7 @@ class Project < ActiveRecord::Base include Gitlab::ConfigHelper include Gitlab::ShellAdapter include Gitlab::VisibilityLevel - include Gitlab::CurrentSettings + # include Gitlab::CurrentSettings include AccessRequestable include Avatarable include CacheMarkdownField @@ -20,7 +20,7 @@ class Project < ActiveRecord::Base include GroupDescendant extend Gitlab::ConfigHelper - extend Gitlab::CurrentSettings + # extend Gitlab::CurrentSettings BoardLimitExceeded = Class.new(StandardError) diff --git a/app/models/project_services/kubernetes_service.rb b/app/models/project_services/kubernetes_service.rb index 8ba07173c74..7b946bb9c62 100644 --- a/app/models/project_services/kubernetes_service.rb +++ b/app/models/project_services/kubernetes_service.rb @@ -1,5 +1,5 @@ class KubernetesService < DeploymentService - include Gitlab::CurrentSettings + # include Gitlab::CurrentSettings include Gitlab::Kubernetes include ReactiveCaching diff --git a/app/models/protected_branch.rb b/app/models/protected_branch.rb index 89bfc5f9a9c..35cfcbf178d 100644 --- a/app/models/protected_branch.rb +++ b/app/models/protected_branch.rb @@ -2,7 +2,7 @@ class ProtectedBranch < ActiveRecord::Base include Gitlab::ShellAdapter include ProtectedRef - extend Gitlab::CurrentSettings + # extend Gitlab::CurrentSettings protected_ref_access_levels :merge, :push diff --git a/app/models/snippet.rb b/app/models/snippet.rb index 9533aa7f555..5d4445152ea 100644 --- a/app/models/snippet.rb +++ b/app/models/snippet.rb @@ -10,7 +10,7 @@ class Snippet < ActiveRecord::Base include Spammable include Editable - extend Gitlab::CurrentSettings + # extend Gitlab::CurrentSettings cache_markdown_field :title, pipeline: :single_line cache_markdown_field :description diff --git a/app/models/user.rb b/app/models/user.rb index 9459b6d4fa4..386e3e82aa3 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -2,10 +2,10 @@ require 'carrierwave/orm/activerecord' class User < ActiveRecord::Base extend Gitlab::ConfigHelper - extend Gitlab::CurrentSettings + # extend Gitlab::CurrentSettings include Gitlab::ConfigHelper - include Gitlab::CurrentSettings + # include Gitlab::CurrentSettings include Gitlab::SQL::Pattern include Avatarable include Referable diff --git a/app/policies/base_policy.rb b/app/policies/base_policy.rb index 8fa7b2753c7..8ebc9a082c7 100644 --- a/app/policies/base_policy.rb +++ b/app/policies/base_policy.rb @@ -13,6 +13,6 @@ class BasePolicy < DeclarativePolicy::Base desc "The application is restricted from public visibility" condition(:restricted_public_level, scope: :global) do - Gitlab::CurrentSettings.current_application_settings.restricted_visibility_levels.include?(Gitlab::VisibilityLevel::PUBLIC) + Gitlab::CurrentSettings.restricted_visibility_levels.include?(Gitlab::VisibilityLevel::PUBLIC) end end diff --git a/app/services/akismet_service.rb b/app/services/akismet_service.rb index aa6f0e841c9..f5a40647a50 100644 --- a/app/services/akismet_service.rb +++ b/app/services/akismet_service.rb @@ -1,5 +1,5 @@ class AkismetService - include Gitlab::CurrentSettings + # include Gitlab::CurrentSettings attr_accessor :owner, :text, :options diff --git a/app/services/auth/container_registry_authentication_service.rb b/app/services/auth/container_registry_authentication_service.rb index f40cd2b06c8..bc863c1a30e 100644 --- a/app/services/auth/container_registry_authentication_service.rb +++ b/app/services/auth/container_registry_authentication_service.rb @@ -1,6 +1,6 @@ module Auth class ContainerRegistryAuthenticationService < BaseService - extend Gitlab::CurrentSettings + # extend Gitlab::CurrentSettings AUDIENCE = 'container_registry'.freeze diff --git a/app/services/base_service.rb b/app/services/base_service.rb index a0cb00dba58..8cda5b4e314 100644 --- a/app/services/base_service.rb +++ b/app/services/base_service.rb @@ -1,6 +1,6 @@ class BaseService include Gitlab::Allowable - include Gitlab::CurrentSettings + # include Gitlab::CurrentSettings attr_accessor :project, :current_user, :params diff --git a/app/services/ci/register_job_service.rb b/app/services/ci/register_job_service.rb index b8db709211a..fc2c99362c6 100644 --- a/app/services/ci/register_job_service.rb +++ b/app/services/ci/register_job_service.rb @@ -2,7 +2,7 @@ module Ci # This class responsible for assigning # proper pending build to runner on runner API request class RegisterJobService - include Gitlab::CurrentSettings + # include Gitlab::CurrentSettings attr_reader :runner diff --git a/app/services/git_push_service.rb b/app/services/git_push_service.rb index bb61136e33b..edc979bc479 100644 --- a/app/services/git_push_service.rb +++ b/app/services/git_push_service.rb @@ -1,6 +1,6 @@ class GitPushService < BaseService attr_accessor :push_data, :push_commits - include Gitlab::CurrentSettings + # include Gitlab::CurrentSettings include Gitlab::Access # The N most recent commits to process in a single push payload. diff --git a/app/services/gravatar_service.rb b/app/services/gravatar_service.rb index e77e08aa380..24340402a05 100644 --- a/app/services/gravatar_service.rb +++ b/app/services/gravatar_service.rb @@ -1,5 +1,5 @@ class GravatarService - include Gitlab::CurrentSettings + # include Gitlab::CurrentSettings def execute(email, size = nil, scale = 2, username: nil) return unless current_application_settings.gravatar_enabled? diff --git a/app/services/groups/nested_create_service.rb b/app/services/groups/nested_create_service.rb index d6f08fc3cce..d222e7707d2 100644 --- a/app/services/groups/nested_create_service.rb +++ b/app/services/groups/nested_create_service.rb @@ -38,7 +38,7 @@ module Groups name: subgroup_name, parent: last_group ) - new_params[:visibility_level] ||= Gitlab::CurrentSettings.current_application_settings.default_group_visibility + new_params[:visibility_level] ||= Gitlab::CurrentSettings.default_group_visibility last_group = Group.find_by_full_path(partial_path) || Groups::CreateService.new(current_user, new_params).execute end diff --git a/app/services/projects/housekeeping_service.rb b/app/services/projects/housekeeping_service.rb index dcef8b66215..74611b7218c 100644 --- a/app/services/projects/housekeeping_service.rb +++ b/app/services/projects/housekeeping_service.rb @@ -7,7 +7,7 @@ # module Projects class HousekeepingService < BaseService - include Gitlab::CurrentSettings + # include Gitlab::CurrentSettings # Timeout set to 24h LEASE_TIMEOUT = 86400 diff --git a/app/services/projects/update_pages_service.rb b/app/services/projects/update_pages_service.rb index d34903c9989..b13e314654b 100644 --- a/app/services/projects/update_pages_service.rb +++ b/app/services/projects/update_pages_service.rb @@ -1,6 +1,6 @@ module Projects class UpdatePagesService < BaseService - include Gitlab::CurrentSettings + # include Gitlab::CurrentSettings BLOCK_SIZE = 32.kilobytes MAX_SIZE = 1.terabyte diff --git a/app/services/submit_usage_ping_service.rb b/app/services/submit_usage_ping_service.rb index 14171bce782..de516cc8f5c 100644 --- a/app/services/submit_usage_ping_service.rb +++ b/app/services/submit_usage_ping_service.rb @@ -11,7 +11,7 @@ class SubmitUsagePingService percentage_projects_prometheus_active leader_service_desk_issues instance_service_desk_issues percentage_service_desk_issues].freeze - include Gitlab::CurrentSettings + # include Gitlab::CurrentSettings def execute return false unless current_application_settings.usage_ping_enabled? diff --git a/app/services/upload_service.rb b/app/services/upload_service.rb index 76700dfcdee..ca0e010295f 100644 --- a/app/services/upload_service.rb +++ b/app/services/upload_service.rb @@ -1,5 +1,5 @@ class UploadService - include Gitlab::CurrentSettings + # include Gitlab::CurrentSettings def initialize(model, file, uploader_class = FileUploader) @model, @file, @uploader_class = model, file, uploader_class diff --git a/app/services/users/build_service.rb b/app/services/users/build_service.rb index 6f05500adea..2493414861b 100644 --- a/app/services/users/build_service.rb +++ b/app/services/users/build_service.rb @@ -1,6 +1,6 @@ module Users class BuildService < BaseService - include Gitlab::CurrentSettings + # include Gitlab::CurrentSettings def initialize(current_user, params = {}) @current_user = current_user diff --git a/app/workers/git_garbage_collect_worker.rb b/app/workers/git_garbage_collect_worker.rb index ec65d3ff65e..ca89b3cb0e4 100644 --- a/app/workers/git_garbage_collect_worker.rb +++ b/app/workers/git_garbage_collect_worker.rb @@ -1,7 +1,7 @@ class GitGarbageCollectWorker include Sidekiq::Worker include DedicatedSidekiqQueue - include Gitlab::CurrentSettings + # include Gitlab::CurrentSettings sidekiq_options retry: false diff --git a/config/initializers/sentry.rb b/config/initializers/sentry.rb index b2da3b3dc19..1d4cd984796 100644 --- a/config/initializers/sentry.rb +++ b/config/initializers/sentry.rb @@ -5,14 +5,14 @@ require 'gitlab/current_settings' def configure_sentry # allow it to fail: it may do so when create_from_defaults is executed before migrations are actually done begin - sentry_enabled = Gitlab::CurrentSettings.current_application_settings.sentry_enabled + sentry_enabled = Gitlab::CurrentSettings.sentry_enabled rescue sentry_enabled = false end if sentry_enabled Raven.configure do |config| - config.dsn = Gitlab::CurrentSettings.current_application_settings.sentry_dsn + config.dsn = Gitlab::CurrentSettings.sentry_dsn config.release = Gitlab::REVISION # Sanitize fields based on those sanitized from Rails. diff --git a/config/initializers/session_store.rb b/config/initializers/session_store.rb index f2fde1e0048..59accab4606 100644 --- a/config/initializers/session_store.rb +++ b/config/initializers/session_store.rb @@ -4,7 +4,7 @@ require 'gitlab/current_settings' # allow it to fail: it may do so when create_from_defaults is executed before migrations are actually done begin - Settings.gitlab['session_expire_delay'] = Gitlab::CurrentSettings.current_application_settings.session_expire_delay || 10080 + Settings.gitlab['session_expire_delay'] = Gitlab::CurrentSettings.session_expire_delay || 10080 rescue Settings.gitlab['session_expire_delay'] ||= 10080 end diff --git a/db/fixtures/production/010_settings.rb b/db/fixtures/production/010_settings.rb index 7626cdb0b9c..524df7053b1 100644 --- a/db/fixtures/production/010_settings.rb +++ b/db/fixtures/production/010_settings.rb @@ -13,13 +13,13 @@ def save(settings, topic) end if ENV['GITLAB_SHARED_RUNNERS_REGISTRATION_TOKEN'].present? - settings = Gitlab::CurrentSettings.current_application_settings + settings = Gitlab::CurrentSettings settings.set_runners_registration_token(ENV['GITLAB_SHARED_RUNNERS_REGISTRATION_TOKEN']) save(settings, 'Runner Registration Token') end if ENV['GITLAB_PROMETHEUS_METRICS_ENABLED'].present? - settings = Gitlab::CurrentSettings.current_application_settings + settings = Gitlab::CurrentSettings value = Gitlab::Utils.to_boolean(ENV['GITLAB_PROMETHEUS_METRICS_ENABLED']) || false settings.prometheus_metrics_enabled = value save(settings, 'Prometheus metrics enabled flag') diff --git a/lib/api/groups.rb b/lib/api/groups.rb index e817dcbbc4b..2bbc72c8666 100644 --- a/lib/api/groups.rb +++ b/lib/api/groups.rb @@ -10,7 +10,7 @@ module API optional :visibility, type: String, values: Gitlab::VisibilityLevel.string_values, default: Gitlab::VisibilityLevel.string_level( - Gitlab::CurrentSettings.current_application_settings.default_group_visibility), + Gitlab::CurrentSettings.default_group_visibility), desc: 'The visibility of the group' optional :lfs_enabled, type: Boolean, desc: 'Enable/disable LFS for the projects in this group' optional :request_access_enabled, type: Boolean, desc: 'Allow users to request member access' diff --git a/lib/api/helpers/runner.rb b/lib/api/helpers/runner.rb index 282af32ca94..74488cab146 100644 --- a/lib/api/helpers/runner.rb +++ b/lib/api/helpers/runner.rb @@ -1,7 +1,7 @@ module API module Helpers module Runner - include Gitlab::CurrentSettings + # include Gitlab::CurrentSettings JOB_TOKEN_HEADER = 'HTTP_JOB_TOKEN'.freeze JOB_TOKEN_PARAM = :token diff --git a/lib/api/runner.rb b/lib/api/runner.rb index a3987c560dd..50b42668063 100644 --- a/lib/api/runner.rb +++ b/lib/api/runner.rb @@ -225,7 +225,7 @@ module API job.artifacts_file = artifacts job.artifacts_metadata = metadata job.artifacts_expire_in = params['expire_in'] || - Gitlab::CurrentSettings.current_application_settings.default_artifacts_expire_in + Gitlab::CurrentSettings.default_artifacts_expire_in if job.save present job, with: Entities::JobRequest::Response diff --git a/lib/email_template_interceptor.rb b/lib/email_template_interceptor.rb index f2bf3d0fb2b..a069bdfc8a2 100644 --- a/lib/email_template_interceptor.rb +++ b/lib/email_template_interceptor.rb @@ -1,6 +1,6 @@ # Read about interceptors in http://guides.rubyonrails.org/action_mailer_basics.html#intercepting-emails class EmailTemplateInterceptor - extend Gitlab::CurrentSettings + # # extend Gitlab::CurrentSettings def self.delivering_email(message) # Remove HTML part if HTML emails are disabled. diff --git a/lib/gitlab/asciidoc.rb b/lib/gitlab/asciidoc.rb index cead1c7eacd..4bd600de1aa 100644 --- a/lib/gitlab/asciidoc.rb +++ b/lib/gitlab/asciidoc.rb @@ -6,7 +6,7 @@ module Gitlab # Parser/renderer for the AsciiDoc format that uses Asciidoctor and filters # the resulting HTML through HTML pipeline filters. module Asciidoc - extend Gitlab::CurrentSettings + # extend Gitlab::CurrentSettings DEFAULT_ADOC_ATTRS = [ 'showtitle', 'idprefix=user-content-', 'idseparator=-', 'env=gitlab', diff --git a/lib/gitlab/auth.rb b/lib/gitlab/auth.rb index 87aeb76b66a..76decab7d29 100644 --- a/lib/gitlab/auth.rb +++ b/lib/gitlab/auth.rb @@ -14,7 +14,7 @@ module Gitlab DEFAULT_SCOPES = [:api].freeze class << self - include Gitlab::CurrentSettings + # include Gitlab::CurrentSettings def find_for_git_client(login, password, project:, ip:) raise "Must provide an IP for rate limiting" if ip.nil? diff --git a/lib/gitlab/auth/unique_ips_limiter.rb b/lib/gitlab/auth/unique_ips_limiter.rb index baa1f802d8a..be5bad2606a 100644 --- a/lib/gitlab/auth/unique_ips_limiter.rb +++ b/lib/gitlab/auth/unique_ips_limiter.rb @@ -20,7 +20,7 @@ module Gitlab end def config - Gitlab::CurrentSettings.current_application_settings + Gitlab::CurrentSettings end def update_and_return_ips_count(user_id, ip) diff --git a/lib/gitlab/current_settings.rb b/lib/gitlab/current_settings.rb index 642f0944354..8a48e636125 100644 --- a/lib/gitlab/current_settings.rb +++ b/lib/gitlab/current_settings.rb @@ -1,73 +1,79 @@ module Gitlab - module CurrentSettings - extend self + class CurrentSettings + class << self + def method_missing(method_sym, *arguments, &block) + Gitlab::CurrentSettings.fetch_settings.send(method_sym, *arguments) + end - def current_application_settings - if RequestStore.active? - RequestStore.fetch(:current_application_settings) { ensure_application_settings! } - else - ensure_application_settings! + def fetch_settings + if RequestStore.active? + RequestStore.fetch(:current_application_settings) { ensure_application_settings! } + else + ensure_application_settings! + end end - end - delegate :sidekiq_throttling_enabled?, to: :current_application_settings + def ensure_application_settings! + return in_memory_application_settings if ENV['IN_MEMORY_APPLICATION_SETTINGS'] == 'true' - def fake_application_settings(defaults = ::ApplicationSetting.defaults) - FakeApplicationSettings.new(defaults) - end + cached_application_settings || uncached_application_settings + end - private + def cached_application_settings + begin + ::ApplicationSetting.cached + rescue ::Redis::BaseError, ::Errno::ENOENT, ::Errno::EADDRNOTAVAIL + # In case Redis isn't running or the Redis UNIX socket file is not available + end + end - def ensure_application_settings! - return in_memory_application_settings if ENV['IN_MEMORY_APPLICATION_SETTINGS'] == 'true' + def uncached_application_settings + return fake_application_settings unless connect_to_db? - cached_application_settings || uncached_application_settings - end + db_settings = ::ApplicationSetting.current - def cached_application_settings - begin - ::ApplicationSetting.cached - rescue ::Redis::BaseError, ::Errno::ENOENT, ::Errno::EADDRNOTAVAIL - # In case Redis isn't running or the Redis UNIX socket file is not available - end - end + # If there are pending migrations, it's possible there are columns that + # need to be added to the application settings. To prevent Rake tasks + # and other callers from failing, use any loaded settings and return + # defaults for missing columns. + if ActiveRecord::Migrator.needs_migration? + defaults = ::ApplicationSetting.defaults + defaults.merge!(db_settings.attributes.symbolize_keys) if db_settings.present? + return fake_application_settings(defaults) + end - def uncached_application_settings - return fake_application_settings unless connect_to_db? + return db_settings if db_settings.present? - db_settings = ::ApplicationSetting.current + ::ApplicationSetting.create_from_defaults || in_memory_application_settings + end - # If there are pending migrations, it's possible there are columns that - # need to be added to the application settings. To prevent Rake tasks - # and other callers from failing, use any loaded settings and return - # defaults for missing columns. - if ActiveRecord::Migrator.needs_migration? - defaults = ::ApplicationSetting.defaults - defaults.merge!(db_settings.attributes.symbolize_keys) if db_settings.present? - return fake_application_settings(defaults) + def in_memory_application_settings + @in_memory_application_settings ||= ::ApplicationSetting.new(::ApplicationSetting.defaults) + rescue ActiveRecord::StatementInvalid, ActiveRecord::UnknownAttributeError + # In case migrations the application_settings table is not created yet, + # we fallback to a simple OpenStruct + fake_application_settings end - return db_settings if db_settings.present? + def connect_to_db? + # When the DBMS is not available, an exception (e.g. PG::ConnectionBad) is raised + active_db_connection = ActiveRecord::Base.connection.active? rescue false - ::ApplicationSetting.create_from_defaults || in_memory_application_settings + active_db_connection && + ActiveRecord::Base.connection.table_exists?('application_settings') + rescue ActiveRecord::NoDatabaseError + false + end end + #extend self - def in_memory_application_settings - @in_memory_application_settings ||= ::ApplicationSetting.new(::ApplicationSetting.defaults) - rescue ActiveRecord::StatementInvalid, ActiveRecord::UnknownAttributeError - # In case migrations the application_settings table is not created yet, - # we fallback to a simple OpenStruct - fake_application_settings - end + # def current_application_settings + # end - def connect_to_db? - # When the DBMS is not available, an exception (e.g. PG::ConnectionBad) is raised - active_db_connection = ActiveRecord::Base.connection.active? rescue false + #delegate :sidekiq_throttling_enabled?, to: :current_application_settings - active_db_connection && - ActiveRecord::Base.connection.table_exists?('application_settings') - rescue ActiveRecord::NoDatabaseError - false - end + # def fake_application_settings(defaults = ::ApplicationSetting.defaults) + # FakeApplicationSettings.new(defaults) + # end end end diff --git a/lib/gitlab/git/storage/circuit_breaker_settings.rb b/lib/gitlab/git/storage/circuit_breaker_settings.rb index d2313fe7c1b..9e306eaaa09 100644 --- a/lib/gitlab/git/storage/circuit_breaker_settings.rb +++ b/lib/gitlab/git/storage/circuit_breaker_settings.rb @@ -21,7 +21,7 @@ module Gitlab private def application_settings - Gitlab::CurrentSettings.current_application_settings + Gitlab::CurrentSettings end end end diff --git a/lib/gitlab/github_import/project_creator.rb b/lib/gitlab/github_import/project_creator.rb index a55adc9b1c8..fa99fbee6c3 100644 --- a/lib/gitlab/github_import/project_creator.rb +++ b/lib/gitlab/github_import/project_creator.rb @@ -1,7 +1,7 @@ module Gitlab module GithubImport class ProjectCreator - include Gitlab::CurrentSettings + # include Gitlab::CurrentSettings attr_reader :repo, :name, :namespace, :current_user, :session_data, :type diff --git a/lib/gitlab/gon_helper.rb b/lib/gitlab/gon_helper.rb index 3a666c2268b..535f7a8002b 100644 --- a/lib/gitlab/gon_helper.rb +++ b/lib/gitlab/gon_helper.rb @@ -3,7 +3,7 @@ module Gitlab module GonHelper include WebpackHelper - include Gitlab::CurrentSettings + # include Gitlab::CurrentSettings def add_gon_variables gon.api_version = 'v4' diff --git a/lib/gitlab/metrics/influx_db.rb b/lib/gitlab/metrics/influx_db.rb index 7b06bb953aa..9ca20d56699 100644 --- a/lib/gitlab/metrics/influx_db.rb +++ b/lib/gitlab/metrics/influx_db.rb @@ -1,7 +1,7 @@ module Gitlab module Metrics module InfluxDb - include Gitlab::CurrentSettings + # include Gitlab::CurrentSettings extend self MUTEX = Mutex.new @@ -17,14 +17,14 @@ module Gitlab def settings @settings ||= { - enabled: current_application_settings[:metrics_enabled], - pool_size: current_application_settings[:metrics_pool_size], - timeout: current_application_settings[:metrics_timeout], - method_call_threshold: current_application_settings[:metrics_method_call_threshold], - host: current_application_settings[:metrics_host], - port: current_application_settings[:metrics_port], - sample_interval: current_application_settings[:metrics_sample_interval] || 15, - packet_size: current_application_settings[:metrics_packet_size] || 1 + enabled: Gitlab::CurrentSettings.metrics_enabled, + pool_size: Gitlab::CurrentSettings.metrics_pool_size, + timeout: Gitlab::CurrentSettings.metrics_timeout, + method_call_threshold: Gitlab::CurrentSettings.metrics_method_call_threshold, + host: Gitlab::CurrentSettings.metrics_host, + port: Gitlab::CurrentSettings.metrics_port, + sample_interval: Gitlab::CurrentSettings.metrics_sample_interval || 15, + packet_size: Gitlab::CurrentSettings.metrics_packet_size || 1 } end diff --git a/lib/gitlab/metrics/prometheus.rb b/lib/gitlab/metrics/prometheus.rb index 460dab47276..a50f7aec5d8 100644 --- a/lib/gitlab/metrics/prometheus.rb +++ b/lib/gitlab/metrics/prometheus.rb @@ -3,8 +3,6 @@ require 'prometheus/client' module Gitlab module Metrics module Prometheus - include Gitlab::CurrentSettings - def metrics_folder_present? multiprocess_files_dir = ::Prometheus::Client.configuration.multiprocess_files_dir @@ -50,7 +48,7 @@ module Gitlab private def prometheus_metrics_enabled_unmemoized - metrics_folder_present? && current_application_settings[:prometheus_metrics_enabled] || false + metrics_folder_present? && Gitlab::CurrentSettings.prometheus_metrics_enabled || false end end end diff --git a/lib/gitlab/performance_bar.rb b/lib/gitlab/performance_bar.rb index e73245b82c1..b7c04a05b90 100644 --- a/lib/gitlab/performance_bar.rb +++ b/lib/gitlab/performance_bar.rb @@ -1,6 +1,6 @@ module Gitlab module PerformanceBar - extend Gitlab::CurrentSettings + # extend Gitlab::CurrentSettings ALLOWED_USER_IDS_KEY = 'performance_bar_allowed_user_ids:v2'.freeze EXPIRY_TIME = 5.minutes diff --git a/lib/gitlab/polling_interval.rb b/lib/gitlab/polling_interval.rb index 4780675a492..45cba360279 100644 --- a/lib/gitlab/polling_interval.rb +++ b/lib/gitlab/polling_interval.rb @@ -1,6 +1,6 @@ module Gitlab class PollingInterval - extend Gitlab::CurrentSettings + # extend Gitlab::CurrentSettings HEADER_NAME = 'Poll-Interval'.freeze diff --git a/lib/gitlab/protocol_access.rb b/lib/gitlab/protocol_access.rb index 09fa14764e6..465734990d3 100644 --- a/lib/gitlab/protocol_access.rb +++ b/lib/gitlab/protocol_access.rb @@ -1,6 +1,6 @@ module Gitlab module ProtocolAccess - extend Gitlab::CurrentSettings + # extend Gitlab::CurrentSettings def self.allowed?(protocol) if protocol == 'web' diff --git a/lib/gitlab/recaptcha.rb b/lib/gitlab/recaptcha.rb index c463dd487a0..201eafb0c1b 100644 --- a/lib/gitlab/recaptcha.rb +++ b/lib/gitlab/recaptcha.rb @@ -1,6 +1,6 @@ module Gitlab module Recaptcha - extend Gitlab::CurrentSettings + # extend Gitlab::CurrentSettings def self.load_configurations! if current_application_settings.recaptcha_enabled diff --git a/lib/gitlab/sentry.rb b/lib/gitlab/sentry.rb index 159d0e7952e..83a17e1a26c 100644 --- a/lib/gitlab/sentry.rb +++ b/lib/gitlab/sentry.rb @@ -1,6 +1,6 @@ module Gitlab module Sentry - extend Gitlab::CurrentSettings + # extend Gitlab::CurrentSettings def self.enabled? Rails.env.production? && current_application_settings.sentry_enabled? diff --git a/lib/gitlab/sidekiq_throttler.rb b/lib/gitlab/sidekiq_throttler.rb index 5512afa45a8..b2bee3b95c4 100644 --- a/lib/gitlab/sidekiq_throttler.rb +++ b/lib/gitlab/sidekiq_throttler.rb @@ -5,7 +5,7 @@ module Gitlab if Gitlab::CurrentSettings.sidekiq_throttling_enabled? require 'sidekiq-limit_fetch' - Gitlab::CurrentSettings.current_application_settings.sidekiq_throttling_queues.each do |queue| + Gitlab::CurrentSettings.sidekiq_throttling_queues.each do |queue| Sidekiq::Queue[queue].limit = queue_limit end end @@ -16,7 +16,7 @@ module Gitlab def queue_limit @queue_limit ||= begin - factor = Gitlab::CurrentSettings.current_application_settings.sidekiq_throttling_factor + factor = Gitlab::CurrentSettings.sidekiq_throttling_factor (factor * Sidekiq.options[:concurrency]).ceil end end diff --git a/lib/gitlab/usage_data.rb b/lib/gitlab/usage_data.rb index 70a403652e7..bfd2b614481 100644 --- a/lib/gitlab/usage_data.rb +++ b/lib/gitlab/usage_data.rb @@ -1,7 +1,7 @@ module Gitlab class UsageData class << self - include Gitlab::CurrentSettings + # include Gitlab::CurrentSettings def data(force_refresh: false) Rails.cache.fetch('usage_data', force: force_refresh, expires_in: 2.weeks) { uncached_data } diff --git a/lib/gitlab/visibility_level.rb b/lib/gitlab/visibility_level.rb index c60bd91ea6e..6f752f4a01c 100644 --- a/lib/gitlab/visibility_level.rb +++ b/lib/gitlab/visibility_level.rb @@ -5,7 +5,7 @@ # module Gitlab module VisibilityLevel - extend CurrentSettings + # extend CurrentSettings extend ActiveSupport::Concern included do diff --git a/lib/tasks/import.rake b/lib/tasks/import.rake index 7f86fd7b45e..146ce1da206 100644 --- a/lib/tasks/import.rake +++ b/lib/tasks/import.rake @@ -91,7 +91,7 @@ class GithubImport end def visibility_level - @repo['private'] ? Gitlab::VisibilityLevel::PRIVATE : Gitlab::CurrentSettings.current_application_settings.default_project_visibility + @repo['private'] ? Gitlab::VisibilityLevel::PRIVATE : Gitlab::CurrentSettings.default_project_visibility end end diff --git a/spec/db/production/settings_spec.rb b/spec/db/production/settings_spec.rb index 79e67330854..6e6c025c13e 100644 --- a/spec/db/production/settings_spec.rb +++ b/spec/db/production/settings_spec.rb @@ -4,7 +4,7 @@ require 'rainbow/ext/string' describe 'seed production settings' do include StubENV let(:settings_file) { Rails.root.join('db/fixtures/production/010_settings.rb') } - let(:settings) { Gitlab::CurrentSettings.current_application_settings } + let(:settings) { Gitlab::CurrentSettings } context 'GITLAB_SHARED_RUNNERS_REGISTRATION_TOKEN is set in the environment' do before do diff --git a/spec/features/admin/admin_health_check_spec.rb b/spec/features/admin/admin_health_check_spec.rb index 4430fc15501..c040f00f241 100644 --- a/spec/features/admin/admin_health_check_spec.rb +++ b/spec/features/admin/admin_health_check_spec.rb @@ -65,8 +65,7 @@ feature "Admin Health Check", :feature, :broken_storage do it 'shows storage failure information' do hostname = Gitlab::Environment.hostname - maximum_failures = Gitlab::CurrentSettings.current_application_settings - .circuitbreaker_failure_count_threshold + maximum_failures = Gitlab::CurrentSettings.circuitbreaker_failure_count_threshold expect(page).to have_content('broken: failed storage access attempt on host:') expect(page).to have_content("#{hostname}: 1 of #{maximum_failures} failures.") diff --git a/spec/helpers/projects_helper_spec.rb b/spec/helpers/projects_helper_spec.rb index 5777b5c4025..70f402393da 100644 --- a/spec/helpers/projects_helper_spec.rb +++ b/spec/helpers/projects_helper_spec.rb @@ -87,7 +87,7 @@ describe ProjectsHelper do end it "includes the application settings" do - settings = Gitlab::CurrentSettings.current_application_settings + settings = Gitlab::CurrentSettings expect(helper.project_list_cache_key(project)).to include(settings.cache_key) end diff --git a/spec/lib/gitlab/auth/unique_ips_limiter_spec.rb b/spec/lib/gitlab/auth/unique_ips_limiter_spec.rb index 22708687a56..96bc8244f68 100644 --- a/spec/lib/gitlab/auth/unique_ips_limiter_spec.rb +++ b/spec/lib/gitlab/auth/unique_ips_limiter_spec.rb @@ -41,7 +41,7 @@ describe Gitlab::Auth::UniqueIpsLimiter, :clean_gitlab_redis_shared_state do context 'allow 2 unique ips' do before do - Gitlab::CurrentSettings.current_application_settings.update!(unique_ips_limit_per_user: 2) + Gitlab::CurrentSettings.update!(unique_ips_limit_per_user: 2) end it 'blocks user trying to login from third ip' do diff --git a/spec/models/key_spec.rb b/spec/models/key_spec.rb index 81c2057e175..df58b734184 100644 --- a/spec/models/key_spec.rb +++ b/spec/models/key_spec.rb @@ -1,7 +1,7 @@ require 'spec_helper' describe Key, :mailer do - include Gitlab::CurrentSettings + # include Gitlab::CurrentSettings describe 'modules' do subject { described_class } diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index 1c3c9068f12..93cdb6fb285 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -1,7 +1,7 @@ require 'spec_helper' describe User do - include Gitlab::CurrentSettings + # include Gitlab::CurrentSettings include ProjectForksHelper describe 'modules' do diff --git a/spec/requests/api/groups_spec.rb b/spec/requests/api/groups_spec.rb index 1671a046fdf..1de6d5a1a3e 100644 --- a/spec/requests/api/groups_spec.rb +++ b/spec/requests/api/groups_spec.rb @@ -471,7 +471,7 @@ describe API::Groups do expect(json_response["name"]).to eq(group[:name]) expect(json_response["path"]).to eq(group[:path]) expect(json_response["request_access_enabled"]).to eq(group[:request_access_enabled]) - expect(json_response["visibility"]).to eq(Gitlab::VisibilityLevel.string_level(Gitlab::CurrentSettings.current_application_settings.default_group_visibility)) + expect(json_response["visibility"]).to eq(Gitlab::VisibilityLevel.string_level(Gitlab::CurrentSettings.default_group_visibility)) end it "creates a nested group", :nested_groups do diff --git a/spec/requests/api/projects_spec.rb b/spec/requests/api/projects_spec.rb index 5964244f8c5..4956b35fdde 100644 --- a/spec/requests/api/projects_spec.rb +++ b/spec/requests/api/projects_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' describe API::Projects do - include Gitlab::CurrentSettings + # include Gitlab::CurrentSettings let(:user) { create(:user) } let(:user2) { create(:user) } diff --git a/spec/requests/api/v3/projects_spec.rb b/spec/requests/api/v3/projects_spec.rb index e5282c3311f..b5eb916f615 100644 --- a/spec/requests/api/v3/projects_spec.rb +++ b/spec/requests/api/v3/projects_spec.rb @@ -1,7 +1,7 @@ require 'spec_helper' describe API::V3::Projects do - include Gitlab::CurrentSettings + # include Gitlab::CurrentSettings let(:user) { create(:user) } let(:user2) { create(:user) } diff --git a/spec/services/groups/nested_create_service_spec.rb b/spec/services/groups/nested_create_service_spec.rb index 6491fb34777..64c5bd07e0b 100644 --- a/spec/services/groups/nested_create_service_spec.rb +++ b/spec/services/groups/nested_create_service_spec.rb @@ -7,8 +7,7 @@ describe Groups::NestedCreateService do shared_examples 'with a visibility level' do it 'creates the group with correct visibility level' do - allow(Gitlab::CurrentSettings.current_application_settings) - .to receive(:default_group_visibility) { Gitlab::VisibilityLevel::INTERNAL } + allow(Gitlab::CurrentSettings).to receive(:default_group_visibility) { Gitlab::VisibilityLevel::INTERNAL } group = service.execute diff --git a/spec/support/stub_configuration.rb b/spec/support/stub_configuration.rb index 4d448a55978..9affebff7e6 100644 --- a/spec/support/stub_configuration.rb +++ b/spec/support/stub_configuration.rb @@ -5,8 +5,7 @@ module StubConfiguration # Stubbing both of these because we're not yet consistent with how we access # current application settings allow_any_instance_of(ApplicationSetting).to receive_messages(to_settings(messages)) - allow(Gitlab::CurrentSettings.current_application_settings) - .to receive_messages(to_settings(messages)) + allow(Gitlab::CurrentSettings).to receive_messages(to_settings(messages)) end def stub_not_protect_default_branch diff --git a/spec/support/stub_env.rb b/spec/support/stub_env.rb index 19fbe572930..a6c64b9339c 100644 --- a/spec/support/stub_env.rb +++ b/spec/support/stub_env.rb @@ -1,6 +1,6 @@ # Inspired by https://github.com/ljkbennett/stub_env/blob/master/lib/stub_env/helpers.rb module StubENV - include Gitlab::CurrentSettings + # include Gitlab::CurrentSettings def stub_env(key_or_hash, value = nil) init_stub unless env_stubbed? diff --git a/spec/views/admin/dashboard/index.html.haml_spec.rb b/spec/views/admin/dashboard/index.html.haml_spec.rb index b4359d819a0..b748b7a8b50 100644 --- a/spec/views/admin/dashboard/index.html.haml_spec.rb +++ b/spec/views/admin/dashboard/index.html.haml_spec.rb @@ -9,7 +9,7 @@ describe 'admin/dashboard/index.html.haml' do assign(:groups, create_list(:group, 1)) allow(view).to receive(:admin?).and_return(true) - allow(view).to receive(:current_application_settings).and_return(Gitlab::CurrentSettings.current_application_settings) + allow(view).to receive(:current_application_settings).and_return(Gitlab::CurrentSettings) end it "shows version of GitLab Workhorse" do diff --git a/spec/views/devise/shared/_signin_box.html.haml_spec.rb b/spec/views/devise/shared/_signin_box.html.haml_spec.rb index 0870b8f09f9..da4c160a142 100644 --- a/spec/views/devise/shared/_signin_box.html.haml_spec.rb +++ b/spec/views/devise/shared/_signin_box.html.haml_spec.rb @@ -5,7 +5,7 @@ describe 'devise/shared/_signin_box' do before do stub_devise assign(:ldap_servers, []) - allow(view).to receive(:current_application_settings).and_return(Gitlab::CurrentSettings.current_application_settings) + allow(view).to receive(:current_application_settings).and_return(Gitlab::CurrentSettings) end it 'is shown when Crowd is enabled' do diff --git a/spec/views/help/index.html.haml_spec.rb b/spec/views/help/index.html.haml_spec.rb index c030129559e..6e45a263454 100644 --- a/spec/views/help/index.html.haml_spec.rb +++ b/spec/views/help/index.html.haml_spec.rb @@ -37,6 +37,6 @@ describe 'help/index' do def stub_helpers allow(view).to receive(:markdown).and_return('') allow(view).to receive(:version_status_badge).and_return('') - allow(view).to receive(:current_application_settings).and_return(Gitlab::CurrentSettings.current_application_settings) + allow(view).to receive(:current_application_settings).and_return(Gitlab::CurrentSettings) end end diff --git a/spec/views/layouts/_head.html.haml_spec.rb b/spec/views/layouts/_head.html.haml_spec.rb index e8e6d2e7a75..80c75abb0e2 100644 --- a/spec/views/layouts/_head.html.haml_spec.rb +++ b/spec/views/layouts/_head.html.haml_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' describe 'layouts/_head' do before do - allow(view).to receive(:current_application_settings).and_return(Gitlab::CurrentSettings.current_application_settings) + allow(view).to receive(:current_application_settings).and_return(Gitlab::CurrentSettings) end it 'escapes HTML-safe strings in page_title' do diff --git a/spec/views/projects/commits/_commit.html.haml_spec.rb b/spec/views/projects/commits/_commit.html.haml_spec.rb index 00547e433c4..0859b65aa19 100644 --- a/spec/views/projects/commits/_commit.html.haml_spec.rb +++ b/spec/views/projects/commits/_commit.html.haml_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' describe 'projects/commits/_commit.html.haml' do before do - allow(view).to receive(:current_application_settings).and_return(Gitlab::CurrentSettings.current_application_settings) + allow(view).to receive(:current_application_settings).and_return(Gitlab::CurrentSettings) end context 'with a singed commit' do diff --git a/spec/views/projects/edit.html.haml_spec.rb b/spec/views/projects/edit.html.haml_spec.rb index 5c6b2e4b042..aad5379eab6 100644 --- a/spec/views/projects/edit.html.haml_spec.rb +++ b/spec/views/projects/edit.html.haml_spec.rb @@ -12,7 +12,7 @@ describe 'projects/edit' do allow(controller).to receive(:current_user).and_return(user) allow(view).to receive_messages(current_user: user, can?: true, - current_application_settings: Gitlab::CurrentSettings.current_application_settings) + current_application_settings: Gitlab::CurrentSettings) end context 'project export disabled' do diff --git a/spec/views/projects/merge_requests/creations/_new_submit.html.haml_spec.rb b/spec/views/projects/merge_requests/creations/_new_submit.html.haml_spec.rb index 9ab105c3238..d0bb85a7667 100644 --- a/spec/views/projects/merge_requests/creations/_new_submit.html.haml_spec.rb +++ b/spec/views/projects/merge_requests/creations/_new_submit.html.haml_spec.rb @@ -14,7 +14,7 @@ describe 'projects/merge_requests/creations/_new_submit.html.haml' do allow(view).to receive(:can?).and_return(true) allow(view).to receive(:url_for).and_return('#') allow(view).to receive(:current_user).and_return(merge_request.author) - allow(view).to receive(:current_application_settings).and_return(Gitlab::CurrentSettings.current_application_settings) + allow(view).to receive(:current_application_settings).and_return(Gitlab::CurrentSettings) end context 'when there are pipelines for merge request but no pipeline for last commit' do diff --git a/spec/views/projects/merge_requests/show.html.haml_spec.rb b/spec/views/projects/merge_requests/show.html.haml_spec.rb index 28d54c2fb77..40a94320c9c 100644 --- a/spec/views/projects/merge_requests/show.html.haml_spec.rb +++ b/spec/views/projects/merge_requests/show.html.haml_spec.rb @@ -28,7 +28,7 @@ describe 'projects/merge_requests/show.html.haml' do allow(view).to receive_messages(current_user: user, can?: true, - current_application_settings: Gitlab::CurrentSettings.current_application_settings) + current_application_settings: Gitlab::CurrentSettings) end context 'when the merge request is closed' do diff --git a/spec/views/projects/tree/show.html.haml_spec.rb b/spec/views/projects/tree/show.html.haml_spec.rb index 3c25e341b39..5d93ecbfce5 100644 --- a/spec/views/projects/tree/show.html.haml_spec.rb +++ b/spec/views/projects/tree/show.html.haml_spec.rb @@ -12,7 +12,7 @@ describe 'projects/tree/show' do allow(view).to receive(:can?).and_return(true) allow(view).to receive(:can_collaborate_with_project?).and_return(true) - allow(view).to receive(:current_application_settings).and_return(Gitlab::CurrentSettings.current_application_settings) + allow(view).to receive(:current_application_settings).and_return(Gitlab::CurrentSettings) end context 'for branch names ending on .json' do diff --git a/spec/views/shared/projects/_project.html.haml_spec.rb b/spec/views/shared/projects/_project.html.haml_spec.rb index f0a4f153699..9b04a5d8310 100644 --- a/spec/views/shared/projects/_project.html.haml_spec.rb +++ b/spec/views/shared/projects/_project.html.haml_spec.rb @@ -4,7 +4,7 @@ describe 'shared/projects/_project.html.haml' do let(:project) { create(:project) } before do - allow(view).to receive(:current_application_settings).and_return(Gitlab::CurrentSettings.current_application_settings) + allow(view).to receive(:current_application_settings).and_return(Gitlab::CurrentSettings) end it 'should render creator avatar if project has a creator' do |