added a configuration via config.xml file
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
* the config file contains the Mensa name and URL, the Cachet Base-URL and API-Key
This commit is contained in:
@ -36,14 +36,12 @@ class CachetAPIController {
|
||||
companion object {
|
||||
|
||||
private val logger: Logger = LoggerFactory.getLogger(CachetAPIController::class.java)
|
||||
private const val baseURL = "https://status.mosad.xyz"
|
||||
private const val apiKey = "" //TODO
|
||||
|
||||
private var oldTotalRequests = 0
|
||||
|
||||
fun postTotalRequests() {
|
||||
try {
|
||||
val url = URL("$baseURL/api/v1/metrics/1/points")
|
||||
val url = URL("${StartupController.getCachetBaseURL()}/api/v1/metrics/1/points")
|
||||
val jsonInputString = "{\"value\": ${getTotalRequests() -oldTotalRequests}, \"timestamp\": \"${(System.currentTimeMillis() / 1000)}\"}"
|
||||
oldTotalRequests = getTotalRequests()
|
||||
|
||||
@ -51,7 +49,7 @@ class CachetAPIController {
|
||||
con.requestMethod = "POST"
|
||||
con.setRequestProperty("Content-Type", "application/json; utf-8")
|
||||
con.setRequestProperty("Accept", "application/json")
|
||||
con.setRequestProperty("X-Cachet-Token", apiKey)
|
||||
con.setRequestProperty("X-Cachet-Token", StartupController.getCachetAPIKey())
|
||||
con.doOutput = true
|
||||
|
||||
val os = con.outputStream
|
||||
|
Reference in New Issue
Block a user