Skip to content

Commit

Permalink
update version in examples
Browse files Browse the repository at this point in the history
  • Loading branch information
tinahollygb committed Aug 1, 2023
1 parent a68a904 commit 40a7e72
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 8 deletions.
2 changes: 1 addition & 1 deletion jvm-kotlin-ktor-example/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ dependencies {
// GrowthBook SDK

// 2. Add the GrowthBook SDK
implementation("com.github.growthbook:growthbook-sdk-java:0.7.1")
implementation("com.github.growthbook:growthbook-sdk-java:0.9.0")

// Test dependencies
testImplementation("io.ktor:ktor-server-tests-jvm:$ktor_version")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ import org.koin.dsl.module
val serviceModule = module {
single<AcmeDonutFeaturesRepository> {
AcmeDonutFeaturesRepository(
endpoint = "https://cdn.growthbook.io/api/features/java_NsrWldWd5bxQJZftGsWKl7R2yD2LtAK8C8EUYh9L8",
apiHost = "https://cdn.growthbook.io",
clientKey = "sdk-pGmC6LrsiUoEUcpZ",
ttlSeconds = 10,
).apply {
onFeaturesRefresh {
Expand All @@ -22,7 +23,8 @@ val serviceModule = module {

single<BasicEncryptedFeaturesRepository> {
BasicEncryptedFeaturesRepository(
endpoint = "https://cdn.growthbook.io/api/features/sdk-862b5mHcP9XPugqD",
apiHost = "https://cdn.growthbook.io",
clientKey = "sdk-862b5mHcP9XPugqD",
encryptionKey = "BhB1wORFmZLTDjbvstvS8w==",
ttlSeconds = 15
).apply {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
package com.growthbook.example.plugins.growthbook

import growthbook.sdk.java.FeatureRefreshStrategy
import growthbook.sdk.java.GBFeaturesRepository

class AcmeDonutFeaturesRepository(
endpoint: String,
apiHost: String,
clientKey: String,
encryptionKey: String? = null,
ttlSeconds: Int
) : GBFeaturesRepository(endpoint, encryptionKey, ttlSeconds)
) : GBFeaturesRepository(apiHost, clientKey, encryptionKey, FeatureRefreshStrategy.STALE_WHILE_REVALIDATE, ttlSeconds)
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
package com.growthbook.example.plugins.growthbook

import growthbook.sdk.java.FeatureRefreshStrategy
import growthbook.sdk.java.GBFeaturesRepository

class BasicEncryptedFeaturesRepository(
endpoint: String,
encryptionKey: String,
apiHost: String,
clientKey: String,
encryptionKey: String? = null,
ttlSeconds: Int
) : GBFeaturesRepository(endpoint, encryptionKey, ttlSeconds)
) : GBFeaturesRepository(apiHost, clientKey, encryptionKey, FeatureRefreshStrategy.STALE_WHILE_REVALIDATE, ttlSeconds)
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,11 @@ fun Routing.acmeRoutes() {
.builder()
.featuresJson(acmeDonutFeaturesRepository.featuresJson)
.attributesJson(user.toJson())
.featureUsageCallback(object : FeatureUsageCallback {
override fun <ValueType : Any?> onFeatureUsage(featureKey: String?, result: FeatureResult<ValueType>?) {
application.log.info("🔵feature usage callback called. key = $featureKey , result = $result")
}
})
.trackingCallback(object : TrackingCallback {
override fun <ValueType : Any?> onTrack(
experiment: Experiment<ValueType>?,
Expand Down

0 comments on commit 40a7e72

Please sign in to comment.