Fix server logs coloring

This commit is contained in:
Claude Brisson
2023-06-12 06:58:45 +02:00
parent 3ff885a7c1
commit 7a5502a29f
2 changed files with 35 additions and 29 deletions

View File

@@ -10,10 +10,12 @@ import okhttp3.internal.EMPTY_REQUEST
class ApiTool {
companion object {
const val JSON = "application/json"
val apiRoot = System.getProperty("pairgoth.api.url").let { base ->
if (base.endsWith('/')) "${base}api/"
else "${base}/api/"
}
val apiRoot =
(System.getProperty("pairgoth.api.url") ?: System.getProperty("pairgoth.webapp.url"))
.let { base ->
if (base.endsWith('/')) "${base}api/"
else "${base}/api/"
}
}
private val client = OkHttpClient()
private fun prepare(url: String) = Request.Builder().url("$apiRoot$url").header("Accept", JSON)