Setting up standalone/client/server run scripts

This commit is contained in:
Claude Brisson
2023-06-12 08:12:58 +02:00
parent 7a5502a29f
commit 2ae8657b83
10 changed files with 31 additions and 17 deletions

View File

@@ -1,7 +1,7 @@
# webapp
env = dev
webapp.url = https://localhost:8080
api.url = https://localhost:8085
api.url = https://localhost:8085/api
# store
store = file

View File

@@ -11,11 +11,9 @@ class ApiTool {
companion object {
const val JSON = "application/json"
val apiRoot =
(System.getProperty("pairgoth.api.url") ?: System.getProperty("pairgoth.webapp.url"))
.let { base ->
if (base.endsWith('/')) "${base}api/"
else "${base}/api/"
}
System.getProperty("pairgoth.api.url")?.let { "${it.removeSuffix("/")}/" }
?: System.getProperty("pairgoth.webapp.url")?.let { "${it.removeSuffix("/")}/api/" }
?: throw Error("no configured API url")
}
private val client = OkHttpClient()
private fun prepare(url: String) = Request.Builder().url("$apiRoot$url").header("Accept", JSON)