Expose the appVersion via the VersionCheck healthcheck
This commit is contained in:
parent
3329b6f475
commit
2822beb0f5
|
@ -36,7 +36,7 @@ class HttpWizard extends Application<HttpWizardConfiguration> {
|
|||
@Override
|
||||
void run(HttpWizardConfiguration configuration,
|
||||
Environment env) {
|
||||
env.healthChecks().register('sanity', new VersionCheck());
|
||||
env.healthChecks().register('sanity', new VersionCheck(configuration));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -18,6 +18,8 @@
|
|||
|
||||
package io.lasagna.httpwizard.checks
|
||||
|
||||
import io.lasagna.httpwizard.HttpWizardConfiguration
|
||||
|
||||
import com.codahale.metrics.health.HealthCheck
|
||||
import com.codahale.metrics.health.HealthCheck.Result
|
||||
|
||||
|
@ -25,9 +27,14 @@ import com.codahale.metrics.health.HealthCheck.Result
|
|||
* VersionCheck simple dumps the version of the running application
|
||||
*/
|
||||
class VersionCheck extends HealthCheck {
|
||||
protected HttpWizardConfiguration config
|
||||
|
||||
VersionCheck(HttpWizardConfiguration c) {
|
||||
this.config = c
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Result check() throws Exception {
|
||||
return Result.healthy()
|
||||
return Result.healthy(this.config.appVersion)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue