summaryrefslogtreecommitdiff
path: root/lib/gitlab/gitpod.rb
blob: e35fb8fed026627addd86c91b16910ee4a106e79 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# frozen_string_literal: true

module Gitlab
  class Gitpod
    class << self
      def feature_available?
        # The gitpod_bundle feature could be conditionally applied, so check if `!off?`
        !feature.off? || feature_enabled?
      end

      def feature_enabled?(actor = nil)
        Feature.enabled?(:gitpod, actor, default_enabled: true)
      end

      def feature_and_settings_enabled?(actor = nil)
        feature_enabled?(actor) && Gitlab::CurrentSettings.gitpod_enabled
      end

      private

      def feature
        Feature.get(:gitpod) # rubocop:disable Gitlab/AvoidFeatureGet
      end
    end
  end
end