diff options
| author | Achilleas Pipinellis <axil@gitlab.com> | 2019-08-20 20:22:43 +0200 |
|---|---|---|
| committer | Achilleas Pipinellis <axil@gitlab.com> | 2019-08-20 20:22:43 +0200 |
| commit | e61308ce1d82e12e5087371469baea4a452875d1 (patch) | |
| tree | 62551a3ae4eab75e5af7e3b35358c07a51b2132f /lib/feature | |
| parent | 4f323bb62fbe71a4352de25cab141f361a3fe1a6 (diff) | |
| parent | 2989ed078c1d45b0959dcecb1bc3c8f4740a3c0d (diff) | |
| download | gitlab-ce-docs-patch-71.tar.gz | |
Merge branch 'master' into docs-patch-71docs-patch-71
Diffstat (limited to 'lib/feature')
| -rw-r--r-- | lib/feature/gitaly.rb | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/lib/feature/gitaly.rb b/lib/feature/gitaly.rb new file mode 100644 index 00000000000..9ded1aed4e3 --- /dev/null +++ b/lib/feature/gitaly.rb @@ -0,0 +1,32 @@ +# frozen_string_literal: true + +require 'set' + +class Feature + class Gitaly + # Server feature flags should use '_' to separate words. + SERVER_FEATURE_FLAGS = + [ + # 'get_commit_signatures'.freeze + ].freeze + + DEFAULT_ON_FLAGS = Set.new([]).freeze + + 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) + rescue ActiveRecord::NoDatabaseError + false + end + + def server_feature_flags + SERVER_FEATURE_FLAGS.map do |f| + ["gitaly-feature-#{f.tr('_', '-')}", enabled?(f).to_s] + end.to_h + end + end + end +end |
