mirror of
https://github.com/floci-io/floci.git
synced 2026-11-23 22:11:36 -05:00
fix: polish HealthController (#188)
* Use more idiomatic map creation in HealthController * Remove unnecessary `@Inject` from HealthController The annotation is not needed as there is a single constructor
This commit is contained in:
1 parent
cdbcb572c8
commit
084237ddf4
1 file changed
+1
-9
@@ -1,14 +1,12 @@
|
||||
package io.github.hectorvent.floci.lifecycle;
|
||||
|
||||
import io.github.hectorvent.floci.core.common.ServiceRegistry;
|
||||
import jakarta.inject.Inject;
|
||||
import jakarta.ws.rs.GET;
|
||||
import jakarta.ws.rs.Path;
|
||||
import jakarta.ws.rs.Produces;
|
||||
import jakarta.ws.rs.core.MediaType;
|
||||
import jakarta.ws.rs.core.Response;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
@@ -23,7 +21,6 @@ public class HealthController {
|
||||
private final ServiceRegistry serviceRegistry;
|
||||
private final String version;
|
||||
|
||||
@Inject
|
||||
public HealthController(ServiceRegistry serviceRegistry) {
|
||||
this.serviceRegistry = serviceRegistry;
|
||||
this.version = resolveVersion();
|
||||
@@ -31,12 +28,7 @@ public class HealthController {
|
||||
|
||||
@GET
|
||||
public Response health() {
|
||||
Map<String, Object> result = new LinkedHashMap<>();
|
||||
result.put("services", serviceRegistry.getServices());
|
||||
result.put("edition", "floci-always-free");
|
||||
result.put("version", version);
|
||||
|
||||
return Response.ok(result).build();
|
||||
return Response.ok(Map.of("services", serviceRegistry.getServices(), "edition", "floci-always-free", "version", version)).build();
|
||||
}
|
||||
|
||||
private static String resolveVersion() {
|
||||
|
||||
Reference in new issue
Block a user