growthbook/growthbook-kotlin

Proposal: extend GBSDKBuilderApp, add setCustomFeaturePath(path)

VovaStelmashchuk opened this issue · 5 comments

Proposal
Extend API, allow developer to changes path "api/features/".

Use case:
We using self hosted growthbook.
Our data flow:
Client -> CDN -> Proxy (the proxy can modify request) -> Growthbook
The proxy has the following routing.
https://our_host.com/growthbook/api/features/{$1} -> http://our_growth_book_instance/api/features{$1}

Extend API.
Add new method to GBSDKBuilderApp

fun setCustomFeaturePath(customPath: String): GBSDKBuilderApp

I can implement the feature.

Will these changes be consistencies with growthbook ?

jdorn commented

Our other SDKs allow passing in a JSON object with feature definitions instead of specifying a host and API key. So the user is responsible for fetching and caching the features. Would that work better for your use case?

Your way works for me too. We will have consistency with other growth book sdk.

My proposal:
Add a new public method

fun getFeatures(rawGBResponse: String, attributes: Map<String, Any>, val forcedVariations: Map<String, Int>, val qaMode : Boolean) : GBFeatures

All code available into #18

Finally version of the API:

val growthbook = GrowthBookLocalSDK(GBLocalContext(enabled = <>, attributes = mapOf(), forcedVariations = mapOf(), qaMode = <>), growthBookFeatures = <growthbook_ json>, trackingCallback)

growthbook.feature("<feature_key>")
fun feature(featureKey: String): GBFeatureResult?

Hi Vova, is this issue is still relevant for you? We are going to look at it.

Currently we migrate to internal fork, The issue not relevant for me now.