mirror of
https://github.com/zoriya/Kyoo.git
synced 2025-06-01 04:34:50 -04:00
Use json in healthcheck
This commit is contained in:
parent
8cf105a550
commit
d0db4815f1
7
.github/workflows/robot.yml
vendored
7
.github/workflows/robot.yml
vendored
@ -30,7 +30,12 @@ jobs:
|
|||||||
|
|
||||||
- name: Start the service
|
- name: Start the service
|
||||||
run: |
|
run: |
|
||||||
docker-compose up -d --wait
|
docker-compose up -d # --wait Wait is not available on gha
|
||||||
|
|
||||||
|
- name: Perform healthchecks
|
||||||
|
run: |
|
||||||
|
docker-compose ps -a
|
||||||
|
wget --retry-connrefused --retry-on-http-error=502 http://localhost:8901/api/health
|
||||||
|
|
||||||
- name: Run robot tests
|
- name: Run robot tests
|
||||||
run: |
|
run: |
|
||||||
|
@ -48,7 +48,7 @@ namespace Kyoo.Core.Api
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns>A status indicating the health of the api.</returns>
|
/// <returns>A status indicating the health of the api.</returns>
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
[ProducesResponseType(StatusCodes.Status204NoContent)]
|
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||||
[ProducesResponseType(StatusCodes.Status503ServiceUnavailable)]
|
[ProducesResponseType(StatusCodes.Status503ServiceUnavailable)]
|
||||||
public async Task<IActionResult> CheckHealth()
|
public async Task<IActionResult> CheckHealth()
|
||||||
{
|
{
|
||||||
@ -60,11 +60,16 @@ namespace Kyoo.Core.Api
|
|||||||
HealthReport result = await _healthCheckService.CheckHealthAsync();
|
HealthReport result = await _healthCheckService.CheckHealthAsync();
|
||||||
return result.Status switch
|
return result.Status switch
|
||||||
{
|
{
|
||||||
HealthStatus.Healthy => NoContent(),
|
HealthStatus.Healthy => Ok(new HealthResult("Healthy")),
|
||||||
HealthStatus.Unhealthy => NoContent(),
|
HealthStatus.Unhealthy => Ok(new HealthResult("Unstable")),
|
||||||
HealthStatus.Degraded => StatusCode(StatusCodes.Status503ServiceUnavailable),
|
HealthStatus.Degraded => StatusCode(StatusCodes.Status503ServiceUnavailable),
|
||||||
_ => StatusCode(StatusCodes.Status500InternalServerError),
|
_ => StatusCode(StatusCodes.Status500InternalServerError),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The result of a health operation.
|
||||||
|
/// </summary>
|
||||||
|
public record HealthResult(string Status);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,24 +2,24 @@ from enum import Enum
|
|||||||
|
|
||||||
|
|
||||||
class Genre(str, Enum):
|
class Genre(str, Enum):
|
||||||
ACTION = "action"
|
ACTION = "Action"
|
||||||
ADVENTURE = "adventure"
|
ADVENTURE = "Adventure"
|
||||||
ANIMATION = "animation"
|
ANIMATION = "Animation"
|
||||||
COMEDY = "comedy"
|
COMEDY = "Comedy"
|
||||||
CRIME = "crime"
|
CRIME = "Crime"
|
||||||
DOCUMENTARY = "documentary"
|
DOCUMENTARY = "Documentary"
|
||||||
DRAMA = "drama"
|
DRAMA = "Drama"
|
||||||
FAMILY = "family"
|
FAMILY = "Family"
|
||||||
FANTASY = "fantasy"
|
FANTASY = "Fantasy"
|
||||||
HISTORY = "history"
|
HISTORY = "History"
|
||||||
HORROR = "horror"
|
HORROR = "Horror"
|
||||||
MUSIC = "music"
|
MUSIC = "Music"
|
||||||
MYSTERY = "mystery"
|
MYSTERY = "Mystery"
|
||||||
ROMANCE = "romance"
|
ROMANCE = "Romance"
|
||||||
SCIENCE_FICTION = "scienceFiction"
|
SCIENCE_FICTION = "Science Fiction"
|
||||||
THRILLER = "thriller"
|
THRILLER = "Thriller"
|
||||||
WAR = "war"
|
WAR = "War"
|
||||||
WESTERN = "western"
|
WESTERN = "Western"
|
||||||
|
|
||||||
def to_kyoo(self):
|
def to_kyoo(self):
|
||||||
return {"name": self}
|
return {"name": f"{self}"}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user