From b81f58a19e31d392d0ae89193dd3f493c66888c2 Mon Sep 17 00:00:00 2001 From: Enrico Costanzi Date: Tue, 21 May 2024 12:28:21 +0200 Subject: [PATCH] change SERVER_PORT to PORT --- docker-compose.yml | 2 +- src/main/kotlin/Configs.kt | 2 +- src/main/kotlin/Main.kt | 2 +- src/main/resources/application.properties | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 50944d0..021ad5c 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -3,7 +3,7 @@ services: 12-factor-demo: image: intesys/twelve-factor-app-kotlin:latest environment: - - SERVER_PORT=8080 + - PORT=8080 - CUSTOM_MESSAGE=Hello World From Docker ports: - 8085:8080 diff --git a/src/main/kotlin/Configs.kt b/src/main/kotlin/Configs.kt index 13fb4f8..b51f68a 100644 --- a/src/main/kotlin/Configs.kt +++ b/src/main/kotlin/Configs.kt @@ -11,7 +11,7 @@ class Configs { loadPropertyFile("classpath:application.properties"), // default dev properties loadPropertyFile("classpath:application-local.properties"), // default personal properties (not versioned) loadPropertyFile("application.properties"), // file system properties (in production) - buildPropertiesFromEnv("SERVER_PORT", "CUSTOM_MESSAGE") // environment variables always win + buildPropertiesFromEnv("PORT", "CUSTOM_MESSAGE") // environment variables always win ) fun loadPropertyFile(filePath: String): Properties { diff --git a/src/main/kotlin/Main.kt b/src/main/kotlin/Main.kt index debe0c2..8304c5a 100644 --- a/src/main/kotlin/Main.kt +++ b/src/main/kotlin/Main.kt @@ -13,7 +13,7 @@ fun main() { val app = Javalin.create { config -> config.staticFiles.add("/public") } - .start(config.getIntegerProperty("SERVER_PORT")) + .start(config.getIntegerProperty("PORT")) app.get("/configs") { ctx -> ctx.json(mapOf("ai" to config.getProperty("CHAT_CLIENT"))) diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index 2a702ea..aa621f0 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -1,4 +1,4 @@ -SERVER_PORT=8080 +PORT=8080 CUSTOM_MESSAGE="Hello World From Configs" CHAT_CLIENT=DUMMY_CHAT