11# frozen_string_literal: true
22
33#
4- # Copyright 2019, Optimizely and contributors
4+ # Copyright 2019-2020 , Optimizely and contributors
55#
66# Licensed under the Apache License, Version 2.0 (the "License");
77# you may not use this file except in compliance with the License.
2222require_relative '../logger'
2323require_relative '../notification_center'
2424require_relative '../project_config'
25+ require_relative '../optimizely_config'
2526require_relative 'project_config_manager'
2627require_relative 'async_scheduler'
2728require 'httparty'
@@ -30,7 +31,7 @@ module Optimizely
3031 class HTTPProjectConfigManager < ProjectConfigManager
3132 # Config manager that polls for the datafile and updated ProjectConfig based on an update interval.
3233
33- attr_reader :stopped
34+ attr_reader :stopped , :optimizely_config
3435
3536 # Initialize config manager. One of sdk_key or url has to be set to be able to use.
3637 #
@@ -73,6 +74,7 @@ def initialize(
7374 @skip_json_validation = skip_json_validation
7475 @notification_center = notification_center . is_a? ( Optimizely ::NotificationCenter ) ? notification_center : NotificationCenter . new ( @logger , @error_handler )
7576 @config = datafile . nil? ? nil : DatafileProjectConfig . create ( datafile , @logger , @error_handler , @skip_json_validation )
77+ @optimizely_config = @config . nil? ? nil : OptimizelyConfig . new ( @config ) . config
7678 @mutex = Mutex . new
7779 @resource = ConditionVariable . new
7880 @async_scheduler = AsyncScheduler . new ( method ( :fetch_datafile_config ) , @polling_interval , auto_update , @logger )
@@ -192,6 +194,7 @@ def set_config(config)
192194 end
193195
194196 @config = config
197+ @optimizely_config = OptimizelyConfig . new ( config ) . config
195198
196199 @notification_center . send_notifications ( NotificationCenter ::NOTIFICATION_TYPES [ :OPTIMIZELY_CONFIG_UPDATE ] )
197200
0 commit comments