From 5bbd70b75accdcde5eb9a15ab2228d6811d06210 Mon Sep 17 00:00:00 2001 From: Matt Date: Tue, 25 Jun 2024 15:51:23 +0100 Subject: [PATCH] chore: Fix auth and another docker latest attempt :pensive: --- .github/workflows/build.yml | 3 ++- backend/src/main/kotlin/Application.kt | 23 +++++------------------ backend/src/main/kotlin/Module.kt | 2 +- 3 files changed, 8 insertions(+), 20 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 147207b..25c28b9 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -74,8 +74,9 @@ jobs: with: images: lichthund/website tags: | - type=ref,event=tag type=semver,pattern={{version}},value=${{steps.version.outputs.VERSION_NAME}}-${{ steps.tags.outputs.sha }} + flavor: | + latest=true - name: Set up Docker Buildx uses: docker/setup-buildx-action@v2 diff --git a/backend/src/main/kotlin/Application.kt b/backend/src/main/kotlin/Application.kt index 56a2f98..d802359 100644 --- a/backend/src/main/kotlin/Application.kt +++ b/backend/src/main/kotlin/Application.kt @@ -14,30 +14,17 @@ import org.jetbrains.exposed.sql.transactions.transaction import java.util.Properties public fun main() { - - val user = System.getenv("DB_USER") - val pass = System.getenv("DB_PASS") - val name = System.getenv("DB_NAME") - val port = System.getenv("DB_PORT") - val server = System.getenv("DB_SERVER") - - println(user) - println(pass) - println(name) - println(port) - println(server) - // Database connection Database.connect( HikariDataSource( HikariConfig( Properties().apply { setProperty("dataSourceClassName", "org.postgresql.ds.PGSimpleDataSource") - setProperty("dataSource.user", user ?: "matt") - setProperty("dataSource.password", pass ?: "test") - setProperty("dataSource.databaseName", name ?: "website") - setProperty("dataSource.portNumber", port ?: "5432") - setProperty("dataSource.serverName", server ?: "localhost") + setProperty("dataSource.user", System.getenv("DB_USER") ?: "matt") + setProperty("dataSource.password", System.getenv("DB_PASS") ?: "test") + setProperty("dataSource.databaseName", System.getenv("DB_NAME") ?: "website") + setProperty("dataSource.portNumber", System.getenv("DB_PORT") ?: "5432") + setProperty("dataSource.serverName", System.getenv("DB_SERVER") ?: "localhost") } ) ) diff --git a/backend/src/main/kotlin/Module.kt b/backend/src/main/kotlin/Module.kt index 1eafbef..0aacaf0 100644 --- a/backend/src/main/kotlin/Module.kt +++ b/backend/src/main/kotlin/Module.kt @@ -28,7 +28,7 @@ import io.ktor.server.routing.routing /** Module of the application. */ public fun Application.module() { - val propertyValue = System.getProperty("WEBSITE_AUTH") + val propertyValue = System.getenv("WEBSITE_AUTH") val bearer = when { developmentMode -> "test" propertyValue == null -> error("Bearer token not set. Application cannot initiate.")