diff options
Diffstat (limited to 'lib/feature')
-rw-r--r-- | lib/feature/gitaly.rb | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/feature/gitaly.rb b/lib/feature/gitaly.rb index 2d0fdf98e8c..e603a1dc8d2 100644 --- a/lib/feature/gitaly.rb +++ b/lib/feature/gitaly.rb @@ -5,25 +5,25 @@ class Feature PREFIX = "gitaly_" class << self - def enabled?(feature_flag) + def enabled?(feature_flag, project = nil) return false unless Feature::FlipperFeature.table_exists? - Feature.enabled?("#{PREFIX}#{feature_flag}") + Feature.enabled?("#{PREFIX}#{feature_flag}", project) rescue ActiveRecord::NoDatabaseError, PG::ConnectionBad false end - def server_feature_flags + def server_feature_flags(project = nil) # We need to check that both the DB connection and table exists return {} unless ::Gitlab::Database.cached_table_exists?(FlipperFeature.table_name) Feature.persisted_names .select { |f| f.start_with?(PREFIX) } - .map do |f| + .to_h do |f| flag = f.delete_prefix(PREFIX) - ["gitaly-feature-#{flag.tr('_', '-')}", enabled?(flag).to_s] - end.to_h + ["gitaly-feature-#{flag.tr('_', '-')}", enabled?(flag, project).to_s] + end end end end |