From f49de9677285ba6287d049a6187ff00bf90ee77f Mon Sep 17 00:00:00 2001 From: Linnea Gräf Date: Fri, 17 Jan 2025 14:21:04 +0100 Subject: feat: Add profile info --- server/core/build.gradle.kts | 4 ++++ .../src/main/kotlin/moe/nea/ledger/server/core/Application.kt | 11 +++++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) (limited to 'server/core') 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) { @@ -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() -- cgit