aboutsummaryrefslogtreecommitdiffstats
path: root/code/api/src/Program.cs
diff options
context:
space:
mode:
authorivarlovlie <git@ivarlovlie.no>2022-12-05 07:03:11 +0100
committerivarlovlie <git@ivarlovlie.no>2022-12-05 07:03:30 +0100
commit834721f61aaee7c2e269cb1df70a973289a73852 (patch)
treed882ba79be976d744014effd3c79adff98a5e28b /code/api/src/Program.cs
parent93efdbc1e7def640ec03f92a7fb447d33133c7ae (diff)
downloadgreatoffice-834721f61aaee7c2e269cb1df70a973289a73852.tar.xz
greatoffice-834721f61aaee7c2e269cb1df70a973289a73852.zip
refactor: Small changes
Diffstat (limited to 'code/api/src/Program.cs')
-rw-r--r--code/api/src/Program.cs9
1 files changed, 4 insertions, 5 deletions
diff --git a/code/api/src/Program.cs b/code/api/src/Program.cs
index 87f0537..749c60a 100644
--- a/code/api/src/Program.cs
+++ b/code/api/src/Program.cs
@@ -1,8 +1,6 @@
global using System;
global using System.Linq;
global using System.IO;
-global using System.Net.Mail;
-global using System.Net;
global using System.Threading;
global using System.Threading.Tasks;
global using System.Collections.Generic;
@@ -74,6 +72,7 @@ public static class Program
new JsonSerializerOptions() {
WriteIndented = true
}));
+
builder.Host.UseSerilog(Log.Logger);
builder.WebHost.ConfigureKestrel(kestrel => { kestrel.AddServerHeader = false; });
@@ -87,7 +86,7 @@ public static class Program
builder.Services.AddLocalization(options => { options.ResourcesPath = "Resources"; });
builder.Services.AddRequestLocalization(options => {
- var supportedCultures = new[] {"en-gb", "no-nb"};
+ var supportedCultures = new[] {"en", "nb"};
options.SetDefaultCulture(supportedCultures[0])
.AddSupportedCultures(supportedCultures)
.AddSupportedUICultures(supportedCultures);
@@ -110,7 +109,6 @@ public static class Program
});
builder.Services.AddQuartzHostedService(options => { options.WaitForJobsToComplete = true; });
-
builder.Services.AddAuthentication(options => {
options.DefaultScheme = CookieAuthenticationDefaults.AuthenticationScheme;
options.DefaultChallengeScheme = CookieAuthenticationDefaults.AuthenticationScheme;
@@ -176,11 +174,13 @@ public static class Program
}
});
});
+
builder.Services.AddPagination(options => {
options.DefaultSize = 50;
options.MaxSize = 100;
options.CanChangeSizeFromQuery = true;
});
+
builder.Services
.AddControllers()
.AddDataAnnotationsLocalization()
@@ -191,7 +191,6 @@ public static class Program
public static WebApplication CreateWebApplication(WebApplicationBuilder builder) {
var app = builder.Build();
-
if (app.Environment.IsDevelopment()) {
app.UseDeveloperExceptionPage();
app.UseCors(cors => {