diff options
author | Linnea Gräf <nea@nea.moe> | 2025-01-17 14:21:04 +0100 |
---|---|---|
committer | Linnea Gräf <nea@nea.moe> | 2025-01-17 14:21:04 +0100 |
commit | f49de9677285ba6287d049a6187ff00bf90ee77f (patch) | |
tree | 90fb77cac434106f6fa183731a4dd681191190ed /server/core | |
parent | 8a9f076d826cb93dcce292180de6fc2be66a7872 (diff) | |
download | LocalTransactionLedger-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.kts | 4 | ||||
-rw-r--r-- | server/core/src/main/kotlin/moe/nea/ledger/server/core/Application.kt | 11 |
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() |