Class: ProductAnalytics::Settings

Inherits:
Object
  • Object
show all
Defined in:
lib/product_analytics/settings.rb

Constant Summary collapse

BASE_CONFIG_KEYS =
%w[product_analytics_data_collector_host cube_api_base_url cube_api_key].freeze
SNOWPLOW_CONFIG_KEYS =
(%w[product_analytics_configurator_connection_string] +
BASE_CONFIG_KEYS).freeze
ALL_CONFIG_KEYS =
(ProductAnalytics::Settings::BASE_CONFIG_KEYS +
ProductAnalytics::Settings::SNOWPLOW_CONFIG_KEYS).freeze

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(project:) ⇒ Settings

Returns a new instance of Settings.



13
14
15
# File 'lib/product_analytics/settings.rb', line 13

def initialize(project:)
  @project = project
end

Class Method Details

.for_project(project) ⇒ Object



34
35
36
# File 'lib/product_analytics/settings.rb', line 34

def for_project(project)
  ProductAnalytics::Settings.new(project: project)
end

Instance Method Details

#configured?Boolean

Returns:

  • (Boolean)


21
22
23
24
25
# File 'lib/product_analytics/settings.rb', line 21

def configured?
  ALL_CONFIG_KEYS.all? do |key|
    get_setting_value(key).present?
  end
end

#enabled?Boolean

Returns:

  • (Boolean)


17
18
19
# File 'lib/product_analytics/settings.rb', line 17

def enabled?
  ::Gitlab::CurrentSettings.product_analytics_enabled? && configured?
end