Compare commits
2 Commits
16bc250789
...
e29c5b2458
| Author | SHA1 | Date | |
|---|---|---|---|
| e29c5b2458 | |||
| 7aa8599535 |
@@ -3,7 +3,9 @@ using FluentValidation;
|
|||||||
using Microsoft.AspNetCore.Authentication.JwtBearer;
|
using Microsoft.AspNetCore.Authentication.JwtBearer;
|
||||||
using Microsoft.Extensions.Options;
|
using Microsoft.Extensions.Options;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
|
using System.Globalization;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
using Microsoft.AspNetCore.Localization;
|
||||||
using Vegasco.Server.Api.Authentication;
|
using Vegasco.Server.Api.Authentication;
|
||||||
using Vegasco.Server.Api.Common;
|
using Vegasco.Server.Api.Common;
|
||||||
using Vegasco.Server.Api.Persistence;
|
using Vegasco.Server.Api.Persistence;
|
||||||
@@ -29,11 +31,11 @@ public static class DependencyInjectionExtensions
|
|||||||
|
|
||||||
private static IServiceCollection AddMiscellaneousServices(this IServiceCollection services)
|
private static IServiceCollection AddMiscellaneousServices(this IServiceCollection services)
|
||||||
{
|
{
|
||||||
services.AddSingleton(sp =>
|
services.AddSingleton(() =>
|
||||||
{
|
{
|
||||||
var assemblyName = Assembly.GetExecutingAssembly()
|
string assemblyName = Assembly.GetExecutingAssembly()
|
||||||
.GetName()
|
.GetName()
|
||||||
.Name ?? "Vegasco.Server.Api";
|
.Name ?? "Vegasco.Server.Api";
|
||||||
return new ActivitySource(assemblyName);
|
return new ActivitySource(assemblyName);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -50,6 +52,21 @@ public static class DependencyInjectionExtensions
|
|||||||
|
|
||||||
services.AddHostedService<ApplyMigrationsService>();
|
services.AddHostedService<ApplyMigrationsService>();
|
||||||
|
|
||||||
|
services.AddRequestLocalization(o =>
|
||||||
|
{
|
||||||
|
string[] cultures =
|
||||||
|
[
|
||||||
|
"en-US",
|
||||||
|
"en",
|
||||||
|
"de-DE",
|
||||||
|
"de"
|
||||||
|
];
|
||||||
|
|
||||||
|
o.SetDefaultCulture(cultures[0])
|
||||||
|
.AddSupportedCultures(cultures)
|
||||||
|
.AddSupportedUICultures(cultures);
|
||||||
|
});
|
||||||
|
|
||||||
return services;
|
return services;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -23,15 +23,7 @@ internal static class StartupExtensions
|
|||||||
{
|
{
|
||||||
app.UseRequestLocalization(o =>
|
app.UseRequestLocalization(o =>
|
||||||
{
|
{
|
||||||
o.SupportedCultures =
|
o.ApplyCurrentCultureToResponseHeaders = true;
|
||||||
[
|
|
||||||
new CultureInfo("en")
|
|
||||||
];
|
|
||||||
|
|
||||||
o.SupportedUICultures = o.SupportedCultures;
|
|
||||||
|
|
||||||
CultureInfo defaultCulture = o.SupportedCultures[0];
|
|
||||||
o.DefaultRequestCulture = new RequestCulture(defaultCulture);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
app.UseHttpsRedirection();
|
app.UseHttpsRedirection();
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ public class GetServerInfo
|
|||||||
public record Response(
|
public record Response(
|
||||||
string FullVersion,
|
string FullVersion,
|
||||||
string CommitId,
|
string CommitId,
|
||||||
DateTime CommitDate,
|
DateTimeOffset CommitDate,
|
||||||
string Environment);
|
string Environment);
|
||||||
|
|
||||||
public static RouteHandlerBuilder MapEndpoint(IEndpointRouteBuilder builder)
|
public static RouteHandlerBuilder MapEndpoint(IEndpointRouteBuilder builder)
|
||||||
@@ -23,7 +23,7 @@ public class GetServerInfo
|
|||||||
return TypedResults.Ok(new Response(
|
return TypedResults.Ok(new Response(
|
||||||
ThisAssembly.AssemblyInformationalVersion,
|
ThisAssembly.AssemblyInformationalVersion,
|
||||||
ThisAssembly.GitCommitId,
|
ThisAssembly.GitCommitId,
|
||||||
ThisAssembly.GitCommitDate,
|
new DateTimeOffset(ThisAssembly.GitCommitDate, TimeSpan.Zero),
|
||||||
environment.EnvironmentName));
|
environment.EnvironmentName));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user