mirror of
https://github.com/mxpv/podsync.git
synced 2024-05-11 05:55:04 +00:00
Prepare for production
- Add caddy server - Add Docker - Minor fixes in status endpoint
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using System.Threading.Tasks;
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Podsync.Services.Resolver;
|
||||
using Podsync.Services.Storage;
|
||||
@@ -7,6 +8,8 @@ namespace Podsync.Controllers
|
||||
{
|
||||
public class StatusController : Controller
|
||||
{
|
||||
private const string ErrorStatus = "ERROR";
|
||||
|
||||
private readonly IStorageService _storageService;
|
||||
private readonly IResolverService _resolverService;
|
||||
|
||||
@@ -18,11 +21,23 @@ namespace Podsync.Controllers
|
||||
|
||||
public async Task<string> Index()
|
||||
{
|
||||
var time = await _storageService.Ping();
|
||||
var storageStatus = ErrorStatus;
|
||||
|
||||
try
|
||||
{
|
||||
var time = await _storageService.Ping();
|
||||
storageStatus = time.ToString();
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
// Nothing to do
|
||||
}
|
||||
|
||||
var resolverStatus = _resolverService.Version ?? ErrorStatus;
|
||||
|
||||
return $"Path: {Request.Path}\r\n" +
|
||||
$"Redis: {time}\r\n" +
|
||||
$"Resolve: {_resolverService.Version}";
|
||||
$"Redis: {storageStatus}\r\n" +
|
||||
$"Resolve: {resolverStatus}";
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user