Skip to content
Browse files

change sdk_key to a resource loader path instead of secret (#1215)

We need to create the LaunchDarklyConfig programmatically in skim's
wrapper for this module and it's a huge PITA to do this with `Secret`
  • Loading branch information...
mightyguava committed Oct 2, 2019
1 parent e73ebdb commit 16ebfbea1f0099af82dedd92470fae2b5edc0da8
@@ -4,14 +4,14 @@ import
import com.launchdarkly.client.LDClient
import com.launchdarkly.client.LDClientInterface
import com.launchdarkly.client.LDConfig
import misk.feature.FeatureFlags
import misk.feature.FeatureService
import misk.ServiceModule
import misk.client.HttpClientSSLConfig
import misk.config.Config
import misk.config.Secret
import misk.feature.FeatureFlags
import misk.feature.FeatureService
import misk.inject.KAbstractModule
import misk.inject.toKey
import misk.resources.ResourceLoader
@@ -35,7 +35,8 @@ class LaunchDarklyModule(
fun provideLaunchDarklyClient(
sslLoader: SslLoader,
sslContextFactory: SslContextFactory
sslContextFactory: SslContextFactory,
resourceLoader: ResourceLoader
): LDClientInterface {
val baseUri = URI.create(config.base_uri)
val ldConfig = LDConfig.Builder()
@@ -57,12 +58,12 @@ class LaunchDarklyModule(
ldConfig.sslSocketFactory(sslContext.socketFactory, x509TrustManager)

return LDClient(config.sdk_key.value.trim(),
return LDClient(resourceLoader.utf8(config.sdk_key)!!.trim(),

data class LaunchDarklyConfig(
val sdk_key: Secret<String>,
val sdk_key: String,
val base_uri: String,
val ssl: HttpClientSSLConfig? = null
) : Config

0 comments on commit 16ebfbe

Please sign in to comment.
You can’t perform that action at this time.