diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-02-12 12:09:01 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-02-12 12:09:01 +0000 |
commit | bd497e352ebd279536ae11855871162e82a3f88c (patch) | |
tree | 2241444d4be33e199d7011b872713071a8f8cd41 /lib/feature | |
parent | 0388886f9439fa93efea29a159522aec5643f7c8 (diff) | |
download | gitlab-ce-bd497e352ebd279536ae11855871162e82a3f88c.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib/feature')
-rw-r--r-- | lib/feature/gitaly.rb | 25 |
1 files changed, 8 insertions, 17 deletions
diff --git a/lib/feature/gitaly.rb b/lib/feature/gitaly.rb index 7e3b9378d10..d327162b34e 100644 --- a/lib/feature/gitaly.rb +++ b/lib/feature/gitaly.rb @@ -1,34 +1,25 @@ # frozen_string_literal: true -require 'set' - class Feature class Gitaly - # Server feature flags should use '_' to separate words. - SERVER_FEATURE_FLAGS = - %w[ - cache_invalidator - inforef_uploadpack_cache - commit_without_batch_check - use_core_delta_islands - use_git_protocol_v2 - ].freeze - - DEFAULT_ON_FLAGS = Set.new([]).freeze + PREFIX = "gitaly_" class << self def enabled?(feature_flag) return false unless Feature::FlipperFeature.table_exists? - default_on = DEFAULT_ON_FLAGS.include?(feature_flag) - Feature.enabled?("gitaly_#{feature_flag}", default_enabled: default_on) + Feature.enabled?("#{PREFIX}#{feature_flag}") rescue ActiveRecord::NoDatabaseError, PG::ConnectionBad false end def server_feature_flags - SERVER_FEATURE_FLAGS.map do |f| - ["gitaly-feature-#{f.tr('_', '-')}", enabled?(f).to_s] + Feature.persisted_names + .select { |f| f.start_with?(PREFIX) } + .map do |f| + flag = f.delete_prefix(PREFIX) + + ["gitaly-feature-#{flag.tr('_', '-')}", enabled?(flag).to_s] end.to_h end end |