mirror of
https://github.com/bitwarden/server.git
synced 2024-12-26 17:37:36 +01:00
cleanup old jobs
This commit is contained in:
parent
c4cc66c391
commit
8021621a3f
@ -1,38 +0,0 @@
|
|||||||
using System.Threading.Tasks;
|
|
||||||
using Microsoft.AspNetCore.Mvc;
|
|
||||||
using Bit.Api.Utilities;
|
|
||||||
using Microsoft.AspNetCore.Authorization;
|
|
||||||
using Bit.Core.Services;
|
|
||||||
|
|
||||||
namespace Bit.Api.Controllers
|
|
||||||
{
|
|
||||||
[Route("jobs")]
|
|
||||||
[SelfHosted(SelfHostedOnly = true)]
|
|
||||||
[AllowAnonymous]
|
|
||||||
public class JobsController : Controller
|
|
||||||
{
|
|
||||||
private readonly ILicensingService _licensingService;
|
|
||||||
private readonly IUserService _userService;
|
|
||||||
|
|
||||||
public JobsController(
|
|
||||||
ILicensingService licensingService,
|
|
||||||
IUserService userService)
|
|
||||||
{
|
|
||||||
_licensingService = licensingService;
|
|
||||||
_userService = userService;
|
|
||||||
}
|
|
||||||
|
|
||||||
[HttpPost("organization-license")]
|
|
||||||
public async Task PostOrganizationLicense()
|
|
||||||
{
|
|
||||||
await _licensingService.ValidateOrganizationsAsync();
|
|
||||||
}
|
|
||||||
|
|
||||||
[HttpPost("refresh-licenses")]
|
|
||||||
public Task PostRefreshLicenses()
|
|
||||||
{
|
|
||||||
// TODO
|
|
||||||
return Task.FromResult(0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -53,9 +53,12 @@ namespace Bit.Jobs
|
|||||||
{
|
{
|
||||||
switch(parameters["j"])
|
switch(parameters["j"])
|
||||||
{
|
{
|
||||||
case "validate-licenses":
|
case "validate-organizations":
|
||||||
await _licensingService.ValidateOrganizationsAsync();
|
await _licensingService.ValidateOrganizationsAsync();
|
||||||
break;
|
break;
|
||||||
|
case "validate-users":
|
||||||
|
// TODO
|
||||||
|
break;
|
||||||
case "refresh-licenses":
|
case "refresh-licenses":
|
||||||
// TODO
|
// TODO
|
||||||
break;
|
break;
|
||||||
|
@ -56,10 +56,7 @@ namespace Bit.Jobs
|
|||||||
GlobalSettings globalSettings)
|
GlobalSettings globalSettings)
|
||||||
{
|
{
|
||||||
loggerFactory
|
loggerFactory
|
||||||
.AddSerilog(env, appLifetime, globalSettings, (e) =>
|
.AddSerilog(env, appLifetime, globalSettings, e => e.Level >= LogEventLevel.Information)
|
||||||
{
|
|
||||||
return e.Level >= LogEventLevel.Information;
|
|
||||||
})
|
|
||||||
.AddConsole()
|
.AddConsole()
|
||||||
.AddDebug();
|
.AddDebug();
|
||||||
}
|
}
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
0 * * * * root dotnet /jobs/Jobs.dll -d /jobs -j alive >> /var/log/cron.log 2>&1
|
0 * * * * root dotnet /jobs/Jobs.dll -d /jobs -j alive >> /var/log/cron.log 2>&1
|
||||||
0 */6 * * * root dotnet /jobs/Jobs.dll -d /jobs -j validate-licenses >> /var/log/cron.log 2>&1
|
0 */6 * * * root dotnet /jobs/Jobs.dll -d /jobs -j validate-organizations >> /var/log/cron.log 2>&1
|
||||||
|
|
||||||
# An empty line is required at the end of this file for a valid cron file.
|
# An empty line is required at the end of this file for a valid cron file.
|
@ -5,9 +5,4 @@
|
|||||||
<TargetFramework>netcoreapp2.0</TargetFramework>
|
<TargetFramework>netcoreapp2.0</TargetFramework>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
|
||||||
<DebugType>full</DebugType>
|
|
||||||
<DebugSymbols>true</DebugSymbols>
|
|
||||||
</PropertyGroup>
|
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
Loading…
Reference in New Issue
Block a user