Skip to content

Commit

Permalink
feat: re-enabled liveness and readyness (#16)
Browse files Browse the repository at this point in the history
  • Loading branch information
diegolagospagopa authored Jun 4, 2022
1 parent 4e93893 commit ed0fbdf
Showing 1 changed file with 25 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseStatus;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.http.HttpStatus;


@RestController
@RequestMapping("/app")
Expand All @@ -30,19 +33,34 @@ public Map<String, String> root()
return map;
}

@GetMapping(path = "/status", produces=MediaType.APPLICATION_JSON_VALUE)
public Map<String, String> status()
@GetMapping(path = "/envs", produces=MediaType.APPLICATION_JSON_VALUE)
public Map<String, String> envs()
{
HashMap<String, String> map = new HashMap<>();
map.put("status", "ok");
System.getenv().forEach((k, v) -> {
map.put(k, v);
});
return map;
}

@GetMapping(path = "/envs", produces=MediaType.APPLICATION_JSON_VALUE)
public Map<String, String> envs()
/*
* Liveness & Readiness
*/
@GetMapping(path = "/live", produces=MediaType.APPLICATION_JSON_VALUE)
@ResponseStatus(HttpStatus.OK)
public Map<String, Boolean> live()
{
HashMap<String, String> map = new HashMap<>();
map.put("MY_ENV_1", myEnv1);
HashMap<String, Boolean> map = new HashMap<>();
map.put("live", true);
return map;
}

@GetMapping(path = "/ready", produces=MediaType.APPLICATION_JSON_VALUE)
@ResponseStatus(HttpStatus.OK)
public Map<String, Boolean> ready()
{
HashMap<String, Boolean> map = new HashMap<>();
map.put("ready", true);
return map;
}
}

0 comments on commit ed0fbdf

Please sign in to comment.