@@ -25,6 +25,44 @@ def initialize(log, config)
2525 opts [ :base_uri ] = polling [ :baseUri ] unless polling [ :baseUri ] . nil?
2626 opts [ :payload_filter_key ] = polling [ :filter ] unless polling [ :filter ] . nil?
2727 opts [ :poll_interval ] = polling [ :pollIntervalMs ] / 1_000.0 unless polling [ :pollIntervalMs ] . nil?
28+ else
29+ opts [ :use_ldd ] = true
30+ end
31+
32+ if config [ :persistentDataStore ]
33+ store_config = { }
34+ store_config [ :prefix ] = config [ :persistentDataStore ] [ :store ] [ :prefix ] if config [ :persistentDataStore ] [ :store ] [ :prefix ]
35+
36+ case config [ :persistentDataStore ] [ :cache ] [ :mode ]
37+ when 'off'
38+ store_config [ :expiration ] = 0
39+ when 'infinite'
40+ # NOTE: We don't actually support infinite cache mode, so we'll just set it to nil for now. This uses a default
41+ # 15 second expiration time in the SDK, which is long enough to pass any test.
42+ store_config [ :expiration ] = nil
43+ when 'ttl'
44+ store_config [ :expiration ] = config [ :persistentDataStore ] [ :cache ] [ :ttl ]
45+ end
46+
47+ case config [ :persistentDataStore ] [ :store ] [ :type ]
48+ when 'redis'
49+ store_config [ :redis_url ] = config [ :persistentDataStore ] [ :store ] [ :dsn ]
50+ store = LaunchDarkly ::Integrations ::Redis . new_feature_store ( store_config )
51+ opts [ :feature_store ] = store
52+ when 'consul'
53+ store_config [ :url ] = config [ :persistentDataStore ] [ :store ] [ :url ]
54+ store = LaunchDarkly ::Integrations ::Consul . new_feature_store ( store_config )
55+ opts [ :feature_store ] = store
56+ when 'dynamodb'
57+ client = Aws ::DynamoDB ::Client . new (
58+ region : 'us-east-1' ,
59+ credentials : Aws ::Credentials . new ( 'dummy' , 'dummy' , 'dummy' ) ,
60+ endpoint : config [ :persistentDataStore ] [ :store ] [ :dsn ]
61+ )
62+ store_config [ :existing_client ] = client
63+ store = LaunchDarkly ::Integrations ::DynamoDB . new_feature_store ( 'sdk-contract-tests' , store_config )
64+ opts [ :feature_store ] = store
65+ end
2866 end
2967
3068 if config [ :events ]
0 commit comments