Prepare for production

- Add caddy server
- Add Docker
- Minor fixes in status endpoint
This commit is contained in:
Maksym Pavlenko
2016-12-23 21:31:44 -08:00
parent e40becede6
commit 588d2efd54
10 changed files with 171 additions and 17 deletions
+19 -4
View File
@@ -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}";
}
}
}