The MicroserviceConfiguration
object provides access to values set in various sources of configurations. As of version 0.0.12, values are read from the following sources, whereas the former override the later:
- Java system properties (e.g.
java -Dserver.port=1234
) - Environment variables (e.g.
SERVER_PORT=1234
) configuration.properties
file in the working directory (e.g.server.port=1234
)defaults.properties
file in the class path (e.g.server.port=1234
)
A few configuration keys are used by Microservices.Utils itself and therefore predefined. Those can be access as read-only properties of the MicroserviceConfiguration
object (e.g. MicroserviceConfiguration.port
)
Own configuration keys can be access like MicroserviceConfiguration.configuration[Key("port", intType)]
or MicroserviceConfiguration.configuration.getOrNull(Key("port", intType))
.
Calling configuredPort()
sets the port of the web server to the configured port number (port
or server.port
as of version 0.0.12).
Calling awaitShutdown()
waits until Spark is shut down. This is especially useful in tests.
Calling status()
activates a status/health/diagnostics JSON object on <HOST>/status/
.
The JSON object looks like this as of version 0.0.12:
{
"status":"up",
"uptime":"32",
"jvmName":"6428@puck",
"jvmSpecName":"Java Virtual Machine Specification",
"jvmSpecVendor":"Oracle Corporation",
"jvmSpecVersion":"1.8",
"vmName":"Java HotSpot(TM) 64-Bit Server VM",
"vmVendor":"Oracle Corporation",
"vmVersion":"25.131-b11",
"compilerName":"HotSpot 64-Bit Tiered Compilers"
}
Developer's notes on how to publish this artifact on bintray via PowerShell:
- ensure to increment version in
gradle.build
$env:BINTRAY_USER = "debuglevel"; $env:BINTRAY_API_KEY = "SUPER_SECRET"; ./gradlew bintrayUpload