Skip to content

Commit

Permalink
[ML4SE-235] server prepared.
Browse files Browse the repository at this point in the history
  • Loading branch information
mikrise2 committed Nov 14, 2023
1 parent 03b5b4e commit e69399d
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 5 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@ kotlin.stdlib.default.dependency = false

# Enable Gradle Configuration Cache -> https://docs.gradle.org/current/userguide/configuration_cache.html
# suppress inspection "UnusedProperty"
org.gradle.unsafe.configuration-cache = true
org.gradle.unsafe.configuration-cache = false
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import org.jetbrains.research.tasktracker.database.DatabaseFactory
import org.jetbrains.research.tasktracker.plugins.configureRouting

fun main() {
embeddedServer(Netty, port = 8888, host = "0.0.0.0", module = Application::module)
embeddedServer(Netty, port = 8080, host = "0.0.0.0", module = Application::module)
.start(wait = true)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ import org.jetbrains.research.tasktracker.database.models.data.*
object DatabaseFactory {
fun init() {
val database = Database.connect(
url = System.getenv("POSTGRES_URL"),
url = System.getenv("DB_URL"),
driver = "org.postgresql.Driver",
user = System.getenv("POSTGRES_USER"),
password = System.getenv("POSTGRES_PASSWORD")
user = System.getenv("DB_USERNAME"),
password = System.getenv("DB_PASSWORD")
)
transaction(database) {
arrayOf(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@ import io.ktor.server.application.*
import io.ktor.server.routing.*
import org.jetbrains.research.tasktracker.plugins.requests.createResearch
import org.jetbrains.research.tasktracker.plugins.requests.createUser
import org.jetbrains.research.tasktracker.plugins.requests.ping
import org.jetbrains.research.tasktracker.plugins.requests.uploadLogFile

fun Application.configureRouting() {
routing {
createUser()
createResearch()
uploadLogFile()
ping()
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package org.jetbrains.research.tasktracker.plugins.requests

import io.ktor.server.application.*
import io.ktor.server.response.*
import io.ktor.server.routing.*

/**
* Routing checking that the server is running.
*/
fun Routing.ping() {
get("/healthz") {
call.respondText("OK")
}
}

0 comments on commit e69399d

Please sign in to comment.