- server config outsourced

- test integrated
This commit is contained in:
stefan
2025-04-18 15:15:42 +02:00
parent 44cef36d00
commit b999cb5832
7 changed files with 150 additions and 13 deletions
@@ -1,14 +1,12 @@
package at.mocode
import io.ktor.server.application.*
import io.ktor.server.engine.*
import io.ktor.server.netty.*
import io.ktor.server.response.*
import io.ktor.server.routing.*
fun main() {
embeddedServer(Netty, port = SERVER_PORT, host = "0.0.0.0", module = Application::module)
.start(wait = true)
fun main(args: Array<String>) {
EngineMain.main(args)
}
fun Application.module() {
@@ -17,4 +15,4 @@ fun Application.module() {
call.respondText("Ktor: ${Greeting().greet()}")
}
}
}
}
@@ -0,0 +1,19 @@
# Grundkonfiguration für Ktor in YAML
ktor:
deployment:
# Der Port, auf dem der Server lauschen soll
port: 8080
# port: ${PORT:8080} # Alternative: Nutzt Env-Variable PORT, sonst 8080
# Optional für Entwicklung: Server bei Änderungen neu laden
# watch:
# - classes
# - resources
application:
# Hier wird Ktor gesagt, welche Funktion die Konfiguration enthält
# PASSE DEN PFAD AN, falls deine Application.kt oder module() anders heißt/liegt!
modules:
- at.mocode.ApplicationKt.module
# Wenn Application.kt direkt unter at.mocode liegt:
# - at.mocode.ApplicationKt.module