Setting up standalone/client/server run scripts
This commit is contained in:
@@ -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
|
||||
|
@@ -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)
|
||||
|
Reference in New Issue
Block a user