summaryrefslogtreecommitdiffstats
path: root/src/server/Startup.cs
diff options
context:
space:
mode:
authorivarlovlie <git@ivarlovlie.no>2022-01-23 18:42:59 +0100
committerivarlovlie <git@ivarlovlie.no>2022-01-23 18:42:59 +0100
commit2d1d7019cbe051d2a42350a6f9d50e1f4ed8bd11 (patch)
tree9a2dd00e28484d891ad683827790d5b839f6c45a /src/server/Startup.cs
parentad8a8095e3942dc8c33c89a41a3ad31200a60472 (diff)
downloadbookmark-thing-2d1d7019cbe051d2a42350a6f9d50e1f4ed8bd11.tar.xz
bookmark-thing-2d1d7019cbe051d2a42350a6f9d50e1f4ed8bd11.zip
feat: Remove stale tokens on a regular basis
Diffstat (limited to 'src/server/Startup.cs')
-rw-r--r--src/server/Startup.cs25
1 files changed, 23 insertions, 2 deletions
diff --git a/src/server/Startup.cs b/src/server/Startup.cs
index a1b6eb1..4b7c097 100644
--- a/src/server/Startup.cs
+++ b/src/server/Startup.cs
@@ -1,5 +1,3 @@
-using System.Reflection;
-
namespace IOL.BookmarkThing.Server;
public class Startup
@@ -21,6 +19,16 @@ public class Startup
return $"Server={host};Port={port};Database={database};User Id={user};Password={password}";
}
+ public string QuartzDatabaseConnectionString() {
+ var host = Configuration.GetValue<string>("QUARTZ_DB_HOST");
+ var port = Configuration.GetValue<string>("QUARTZ_DB_PORT");
+ var database = Configuration.GetValue<string>("QUARTZ_DB_NAME");
+ var user = Configuration.GetValue<string>("QUARTZ_DB_USER");
+ var password = Configuration.GetValue<string>("QUARTZ_DB_PASSWORD");
+ return $"Server={host};Port={port};Database={database};User Id={user};Password={password}";
+ }
+
+
// This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services) {
services.AddDataProtection()
@@ -46,6 +54,19 @@ public class Startup
}
});
+ services.AddQuartz(options => {
+ options.UsePersistentStore(o => {
+ o.UsePostgres(QuartzDatabaseConnectionString());
+ o.UseSerializer<QuartzJsonSerializer>();
+ });
+ options.UseMicrosoftDependencyInjectionJobFactory();
+ options.RegisterJobs();
+ });
+
+ services.AddQuartzHostedService(options => {
+ options.WaitForJobsToComplete = true;
+ });
+
services.AddAuthentication(CookieAuthenticationDefaults.AuthenticationScheme)
.AddCookie(options => {
options.Cookie.Name = "bookmarkthing_session";