Skip to content

Commit

Permalink
Add environment variable for deployment url
Browse files Browse the repository at this point in the history
  • Loading branch information
gchristov committed Aug 13, 2023
1 parent d6edbf5 commit f02c326
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
16 changes: 16 additions & 0 deletions backend/common-service/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
import com.gchristov.thecodinglove.gradleplugins.getLocalSecret

val packageId = "com.gchristov.thecodinglove.commonservice"

plugins {
id("kmp-module-plugin")
id("build-config-plugin")
}

kotlin {
Expand All @@ -10,4 +15,15 @@ kotlin {
}
}
}
}

buildkonfig {
packageName = packageId
defaultConfigs {
buildConfigField(
type = com.codingfeline.buildkonfig.compiler.FieldSpec.Type.STRING,
name = "APP_PUBLIC_URL",
value = getLocalSecret(rootProject, "APP_PUBLIC_URL")
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -45,5 +45,6 @@ object CommonServiceModule : DiModule() {
): PubSubSubscription = GoogleCloudPubSubSubscription(
log = log,
pubSub = pubSub,
pubSubDomain = BuildKonfig.APP_PUBLIC_URL,
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import kotlin.js.json
internal class GoogleCloudPubSubSubscription(
private val log: Logger,
private val pubSub: GoogleCloudPubSubExternals.PubSub,
private val pubSubDomain: String,
) : PubSubSubscription {
init {
process.env.GOOGLE_APPLICATION_CREDENTIALS = "local-credentials-pubsub.json"
Expand All @@ -30,7 +31,7 @@ internal class GoogleCloudPubSubSubscription(
log.d("Creating PubSub subscription $subscription")
pubSubSubscription.create(
// TODO: Fix this to use a env variable for the website
json("pushEndpoint" to "https://codinglove.serveo.net${httpPath}")
json("pushEndpoint" to "$pubSubDomain/$httpPath")
).await()
}
Either.Right(Unit)
Expand Down

0 comments on commit f02c326

Please sign in to comment.