Skip to content

Commit

Permalink
chore: Fix auth and another docker latest attempt 😔
Browse files Browse the repository at this point in the history
  • Loading branch information
LichtHund committed Jun 25, 2024
1 parent 0a9bbba commit 5bbd70b
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 20 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
23 changes: 5 additions & 18 deletions backend/src/main/kotlin/Application.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}
)
)
Expand Down
2 changes: 1 addition & 1 deletion backend/src/main/kotlin/Module.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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.")
Expand Down

0 comments on commit 5bbd70b

Please sign in to comment.