aboutsummaryrefslogtreecommitdiff
path: root/server/core
diff options
context:
space:
mode:
authorLinnea Gräf <nea@nea.moe>2025-01-17 14:21:04 +0100
committerLinnea Gräf <nea@nea.moe>2025-01-17 14:21:04 +0100
commitf49de9677285ba6287d049a6187ff00bf90ee77f (patch)
tree90fb77cac434106f6fa183731a4dd681191190ed /server/core
parent8a9f076d826cb93dcce292180de6fc2be66a7872 (diff)
downloadLocalTransactionLedger-f49de9677285ba6287d049a6187ff00bf90ee77f.tar.gz
LocalTransactionLedger-f49de9677285ba6287d049a6187ff00bf90ee77f.tar.bz2
LocalTransactionLedger-f49de9677285ba6287d049a6187ff00bf90ee77f.zip
feat: Add profile info
Diffstat (limited to 'server/core')
-rw-r--r--server/core/build.gradle.kts4
-rw-r--r--server/core/src/main/kotlin/moe/nea/ledger/server/core/Application.kt11
2 files changed, 13 insertions, 2 deletions
diff --git a/server/core/build.gradle.kts b/server/core/build.gradle.kts
index deee068..f254df1 100644
--- a/server/core/build.gradle.kts
+++ b/server/core/build.gradle.kts
@@ -2,6 +2,7 @@ plugins {
kotlin("jvm")
kotlin("plugin.serialization")
application
+ id("com.github.gmazzo.buildconfig")
}
@@ -29,3 +30,6 @@ application {
"-Dledger.databasefolder=${project(":mod").file("run/money-ledger").absoluteFile}")
mainClass.set("moe.nea.ledger.server.core.ApplicationKt")
}
+buildConfig {
+ packageName("moe.nea.ledger.gen")
+}
diff --git a/server/core/src/main/kotlin/moe/nea/ledger/server/core/Application.kt b/server/core/src/main/kotlin/moe/nea/ledger/server/core/Application.kt
index 56492db..eef43d6 100644
--- a/server/core/src/main/kotlin/moe/nea/ledger/server/core/Application.kt
+++ b/server/core/src/main/kotlin/moe/nea/ledger/server/core/Application.kt
@@ -12,11 +12,14 @@ import io.ktor.server.routing.route
import io.ktor.server.routing.routing
import kotlinx.serialization.json.Json
import moe.nea.ledger.database.Database
+import moe.nea.ledger.gen.BuildConfig
import moe.nea.ledger.server.core.api.Documentation
import moe.nea.ledger.server.core.api.Info
+import moe.nea.ledger.server.core.api.Server
import moe.nea.ledger.server.core.api.apiRouting
import moe.nea.ledger.server.core.api.openApiDocsJson
import moe.nea.ledger.server.core.api.openApiUi
+import moe.nea.ledger.server.core.api.setApiRoot
import java.io.File
fun main(args: Array<String>) {
@@ -30,7 +33,10 @@ fun Application.module() {
info = Info(
"Ledger Analysis Server",
"Your local API for loading ledger data",
- "TODO: buildconfig"
+ BuildConfig.VERSION
+ )
+ servers.add(
+ Server("http://localhost:8080/api", "Your Local Server")
)
}
install(ContentNegotiation) {
@@ -44,8 +50,9 @@ fun Application.module() {
database.loadAndUpgrade()
routing {
route("/api") {
- this.apiRouting(database)
+ setApiRoot()
get { call.respondRedirect("/openapi/") }
+ apiRouting(database)
}
route("/api.json") {
openApiDocsJson()