Ready for first release
This commit is contained in:
+14
-3
@@ -1,3 +1,5 @@
|
||||
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
|
||||
|
||||
plugins {
|
||||
alias(libs.plugins.jvm)
|
||||
alias(libs.plugins.ktor)
|
||||
@@ -5,7 +7,6 @@ plugins {
|
||||
}
|
||||
|
||||
group = "com.jaytux.phoebench"
|
||||
//version = "1.0-SNAPSHOT"
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
@@ -65,12 +66,22 @@ kotlin {
|
||||
}
|
||||
|
||||
application {
|
||||
mainClass.set("com.jaytux.phoebench.server.MainKt")
|
||||
mainClass = "io.ktor.server.netty.EngineMain"
|
||||
}
|
||||
|
||||
tasks.withType<Jar> {
|
||||
manifest {
|
||||
attributes["Main-Class"] = application.mainClass
|
||||
}
|
||||
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
|
||||
duplicatesStrategy = DuplicatesStrategy.WARN
|
||||
}
|
||||
|
||||
ktor {
|
||||
fatJar {
|
||||
}
|
||||
}
|
||||
|
||||
tasks.withType<ShadowJar> {
|
||||
mergeServiceFiles()
|
||||
append("reference.conf")
|
||||
}
|
||||
@@ -10,7 +10,6 @@ import io.ktor.serialization.kotlinx.json.*
|
||||
import io.ktor.server.application.*
|
||||
import io.ktor.server.auth.*
|
||||
import io.ktor.server.auth.jwt.*
|
||||
import io.ktor.server.netty.*
|
||||
import io.ktor.server.plugins.autohead.*
|
||||
import io.ktor.server.plugins.calllogging.*
|
||||
import io.ktor.server.plugins.contentnegotiation.*
|
||||
@@ -24,12 +23,10 @@ import kotlinx.serialization.json.Json
|
||||
import org.jetbrains.exposed.v1.jdbc.transactions.transaction
|
||||
import kotlin.uuid.Uuid
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
DB.db
|
||||
EngineMain.main(args)
|
||||
}
|
||||
|
||||
fun Application.module() {
|
||||
DB.db
|
||||
println("Entering module...")
|
||||
|
||||
install(ContentNegotiation) {
|
||||
json()
|
||||
}
|
||||
@@ -147,22 +144,22 @@ fun Application.module() {
|
||||
|
||||
get("{...}") {
|
||||
println("Fallback for GET ${call.request.path()} triggered.")
|
||||
call.respond(HttpStatusCode.NotFound, ErrorResponse("Could not find ${call.request.path()}"))
|
||||
call.respondText(status = HttpStatusCode.NotFound, text = Json.encodeToString(ErrorResponse("Could not find ${call.request.path()}")), contentType = ContentType.Application.Json)
|
||||
}
|
||||
|
||||
post("{...}") {
|
||||
println("Fallback for POST ${call.request.path()} triggered.")
|
||||
call.respond(HttpStatusCode.NotFound, ErrorResponse("Could not find ${call.request.path()}"))
|
||||
call.respondText(status = HttpStatusCode.NotFound, text = Json.encodeToString(ErrorResponse("Could not find ${call.request.path()}")), contentType = ContentType.Application.Json)
|
||||
}
|
||||
|
||||
delete("{...}") {
|
||||
println("Fallback for DELETE ${call.request.path()} triggered.")
|
||||
call.respond(HttpStatusCode.NotFound, ErrorResponse("Could not find ${call.request.path()}"))
|
||||
call.respondText(status = HttpStatusCode.NotFound, text = Json.encodeToString(ErrorResponse("Could not find ${call.request.path()}")), contentType = ContentType.Application.Json)
|
||||
}
|
||||
|
||||
patch("{...}") {
|
||||
println("Fallback for PATCH ${call.request.path()} triggered.")
|
||||
call.respond(HttpStatusCode.NotFound, ErrorResponse("Could not find ${call.request.path()}"))
|
||||
call.respondText(status = HttpStatusCode.NotFound, text = Json.encodeToString(ErrorResponse("Could not find ${call.request.path()}")), contentType = ContentType.Application.Json)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,18 +1,23 @@
|
||||
ktor {
|
||||
deployment {
|
||||
port = ${PORT}
|
||||
port = 8080
|
||||
port = ${?PORT}
|
||||
}
|
||||
application {
|
||||
modules = [com.jaytux.phoebench.server.MainKt.module]
|
||||
}
|
||||
jwt {
|
||||
secret = ${JWT_SECRET}
|
||||
issuer = ${JWT_ISSUER}
|
||||
audience = ${JWT_AUDIENCE}
|
||||
realm = ${JWT_REALM}
|
||||
secret = "NO_SECRET_SET!"
|
||||
secret = ${?JWT_SECRET}
|
||||
issuer = "http://0.0.0.0"
|
||||
issuer = ${?JWT_ISSUER}
|
||||
audience = "http://0.0.0.0"
|
||||
audience = ${?JWT_AUDIENCE}
|
||||
realm = "phoebench"
|
||||
realm = ${?JWT_REALM}
|
||||
}
|
||||
cors {
|
||||
enableLocalhostOn = ${PHOEBENCH_DEV_CLIENT_PORT}
|
||||
enableLocalhostOn = ${?PHOEBENCH_DEV_CLIENT_PORT}
|
||||
browserOrigin = ${?PHOEBENCH_SAFE_CLIENT}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user