diff --git a/packages/deriv_feature_flag/lib/feature_flag/feature_flag_config.dart b/packages/deriv_feature_flag/lib/feature_flag/feature_flag_config.dart index bf3ea2f19..dded2b4f4 100644 --- a/packages/deriv_feature_flag/lib/feature_flag/feature_flag_config.dart +++ b/packages/deriv_feature_flag/lib/feature_flag/feature_flag_config.dart @@ -15,11 +15,19 @@ class FeatureFlagConfig { /// Force specific experiments to always assign a specific variation (QA). final Map forcedVariations; + /// Feature flag service host url + final String hostUrl; + + /// Feature flag service client key + final String clientKey; + FeatureFlagConfig({ this.attributes = const {}, this.qaMode = false, this.enable = true, this.forcedVariations = const {}, this.features = const {}, + required this.hostUrl, + required this.clientKey, }); } diff --git a/packages/deriv_feature_flag/lib/growthbook/deriv_growth_book.dart b/packages/deriv_feature_flag/lib/growthbook/deriv_growth_book.dart index f96708642..4e30b4115 100644 --- a/packages/deriv_feature_flag/lib/growthbook/deriv_growth_book.dart +++ b/packages/deriv_feature_flag/lib/growthbook/deriv_growth_book.dart @@ -10,8 +10,8 @@ class DerivGrowthBook extends BaseGrowthBook implements GrowthBookConfig { DerivGrowthBook({required FeatureFlagConfig featureFlagConfig}) { _gbsdkBuilderApp = GBSDKBuilderApp( - hostURL: GrowthBookConfig.gbHostUrl, - apiKey: GrowthBookConfig.gbClientKey, + hostURL: featureFlagConfig.hostUrl, + apiKey: featureFlagConfig.clientKey, attributes: featureFlagConfig.attributes, enable: featureFlagConfig.enable, qaMode: featureFlagConfig.qaMode, diff --git a/packages/deriv_feature_flag/lib/growthbook/growth_book_config.dart b/packages/deriv_feature_flag/lib/growthbook/growth_book_config.dart index 8efdf8e99..cde52aa29 100644 --- a/packages/deriv_feature_flag/lib/growthbook/growth_book_config.dart +++ b/packages/deriv_feature_flag/lib/growthbook/growth_book_config.dart @@ -1,15 +1,8 @@ import 'dart:developer' as logger; -import 'package:deriv_env/env.dart'; import 'package:growthbook_sdk_flutter/growthbook_sdk_flutter.dart'; /// A class that contains the whole GrowthBook config data. class GrowthBookConfig { - /// Determine the GrowthBook client api key. - static String get gbClientKey => Env().get('GROWTHBOOK_API_KEY'); - - /// Determine the Growth Book Host URL. - static String get gbHostUrl => Env().get('GROWTHBOOK_HOST_URL'); - /// Convert client side FeatureFlags to GrowthBook FeatureFlags. static Map gbFeatures(Map features) { if (features.isEmpty) { diff --git a/packages/deriv_feature_flag/pubspec.yaml b/packages/deriv_feature_flag/pubspec.yaml index 7be23b073..6d8722cdf 100644 --- a/packages/deriv_feature_flag/pubspec.yaml +++ b/packages/deriv_feature_flag/pubspec.yaml @@ -1,5 +1,5 @@ name: deriv_feature_flag -description: A new Flutter package project. +description: wrapper to handle feature flag for deriv applications version: 0.1.0 publish_to: none @@ -7,11 +7,6 @@ environment: sdk: ">=3.0.0 <4.0.0" dependencies: - deriv_env: - git: - url: git@github.com:regentmarkets/flutter-deriv-packages.git - path: packages/deriv_env - ref: deriv_env-v0.0.1+1 flutter: sdk: flutter growthbook_sdk_flutter: ^3.0.0+0 diff --git a/packages/deriv_feature_flag/test/feature_flag/deriv_feature_flag_test.dart b/packages/deriv_feature_flag/test/feature_flag/deriv_feature_flag_test.dart index 5a4777713..042e343a5 100644 --- a/packages/deriv_feature_flag/test/feature_flag/deriv_feature_flag_test.dart +++ b/packages/deriv_feature_flag/test/feature_flag/deriv_feature_flag_test.dart @@ -10,6 +10,8 @@ import 'mock_classes.dart'; void main() async { final FeatureFlagConfig featureFlagConfig = FeatureFlagConfig( + hostUrl: '', + clientKey: '', features: { Features.isSocialAuthEnabled.key: GBFeature(defaultValue: true), }, diff --git a/packages/deriv_feature_flag/test/feature_flag/feature_flag_repository_test.dart b/packages/deriv_feature_flag/test/feature_flag/feature_flag_repository_test.dart index 0f9a9a95b..5ba2eb005 100644 --- a/packages/deriv_feature_flag/test/feature_flag/feature_flag_repository_test.dart +++ b/packages/deriv_feature_flag/test/feature_flag/feature_flag_repository_test.dart @@ -10,6 +10,8 @@ import 'mock_classes.dart'; void main() { final mockGrowthBookSDK = MockGrowthBookSDK(); final FeatureFlagConfig featureFlagConfig = FeatureFlagConfig( + hostUrl: '', + clientKey: '', features: { Features.isSocialAuthEnabled.key: GBFeature(defaultValue: true), },