Fix db host

This commit is contained in:
Mikołaj Pich 2023-09-18 21:47:34 +02:00
parent 7607d6a4fc
commit f071e890ad
3 changed files with 4 additions and 1 deletions

View file

@ -1 +1,2 @@
TOKEN= TOKEN=
DB_HOST=db

View file

@ -14,6 +14,7 @@ jobs:
uses: SpicyPizza/create-envfile@v1 uses: SpicyPizza/create-envfile@v1
with: with:
envkey_TOKEN: ${{ secrets.TOKEN }} envkey_TOKEN: ${{ secrets.TOKEN }}
envkey_DB_HOST: db
- uses: alex-ac/github-action-ssh-docker-compose@master - uses: alex-ac/github-action-ssh-docker-compose@master
name: Docker-Compose Remote Deployment name: Docker-Compose Remote Deployment
with: with:

View file

@ -9,8 +9,9 @@ import org.jetbrains.exposed.sql.transactions.transaction
object DatabaseFactory { object DatabaseFactory {
fun init() { fun init() {
val host = System.getenv("DB_HOST") ?: "localhost"
val database = Database.connect( val database = Database.connect(
url = "jdbc:pgsql://localhost:5004/schools", url = "jdbc:pgsql://$host:5004/schools",
driver = "com.impossibl.postgres.jdbc.PGDriver", driver = "com.impossibl.postgres.jdbc.PGDriver",
user = "postgres", user = "postgres",
password = "postgres", password = "postgres",