about summary refs log tree commit diff
path: root/configuration.nix
diff options
context:
space:
mode:
authorVika <vika@fireburn.ru>2023-07-22 12:32:36 +0300
committerVika <vika@fireburn.ru>2023-07-22 12:34:56 +0300
commitb9e66068484ea4111cd4adf63abc1afdac056b22 (patch)
treefac3a9311be580079260a690ec5f33a15b71833f /configuration.nix
parent3c8122e54cdba2c635e723eb33f1d690f05767a7 (diff)
Mount webmention handling routes and tasks
Diffstat (limited to 'configuration.nix')
-rw-r--r--configuration.nix33
1 files changed, 15 insertions, 18 deletions
diff --git a/configuration.nix b/configuration.nix
index e86f4b7..bdd353a 100644
--- a/configuration.nix
+++ b/configuration.nix
@@ -76,6 +76,16 @@ in {
              credentials are stored per-site.
         '';
       };
+      jobQueueUri = mkOption {
+        type = types.nullOr types.str;
+        default = "postgres://localhost/kittybox?host=/run/postgresql";
+        description = lib.mdDoc ''
+          Set the job queue backend. Available options are:
+           - `postgres://` - PostgreSQL based job queue. It shares the schema
+             with the Kittybox PostgreSQL backend, so Kittybox can reuse the
+             same database for both.
+        '';
+      };
       microsubServer = mkOption {
         type = types.nullOr types.str;
         default = null;
@@ -86,20 +96,6 @@ in {
           https://aperture.p3k.io/ if you don't have one yet!
         '';
       };
-      webmentionEndpoint = mkOption {
-        type = types.nullOr types.str;
-        default = null;
-        example = "https://webmention.io/example.com/webmention";
-        description = ''
-          The URL of your webmention endpoint, which allows you to
-          receive notifications about your site's content being featured
-          or interacted with elsewhere on the IndieWeb.
-
-          By default Kittybox expects the Webmention endpoint to post
-          updates using an internal token. kittybox-webmention is an
-          endpoint capable of that.
-        '';
-      };
       internalTokenFile = mkOption {
         type = types.nullOr types.str;
         default = null;
@@ -110,14 +106,14 @@ in {
         type = types.str;
         default = "/var/lib/kittybox/cookie_secret_key";
         example = "/run/secrets/kittybox-cookie-secret";
-        description = "A secret file to encrypt cookies with the contents of. Should be at least 32 bytes in length. A random persistent file will be generated if this variable is left untouched.";
+        description = "A secret file to encrypt cookies with the contents of. Should be at least 32 bytes in length. A random persistent file will be generated if it doesn't exist or is invalid.";
       };
     };
   };
   config = lib.mkIf cfg.enable {
     assertions = [
       {
-        assertion = lib.strings.hasPrefix cfg.backendUri "postgres://" -> cfg.package.hasPostgres;
+        assertion = (lib.strings.hasPrefix cfg.backendUri "postgres://" || lib.strings.hasPrefix cfg.jobQueueUri "postgres://") -> cfg.package.hasPostgres;
         message = "To use the Postgres backend, Kittybox has to be compiled with Postgres support enabled.";
       }
     ];
@@ -143,7 +139,8 @@ in {
 
       restartTriggers = [
         cfg.package
-        cfg.backendUri cfg.blobstoreUri cfg.authstoreUri
+        cfg.backendUri cfg.blobstoreUri
+        cfg.authstoreUri cfg.jobQueueUri
         cfg.internalTokenFile
         cfg.bind cfg.port
         cfg.cookieSecretFile
@@ -151,10 +148,10 @@ in {
 
       environment = {
         MICROSUB_ENDPOINT = cfg.microsubServer;
-        WEBMENTION_ENDPOINT = cfg.webmentionEndpoint;
         BACKEND_URI = cfg.backendUri;
         BLOBSTORE_URI = cfg.blobstoreUri;
         AUTH_STORE_URI = cfg.authstoreUri;
+        JOB_QUEUE_URI = cfg.jobQueueUri;
         RUST_LOG = "${cfg.logLevel}";
         COOKIE_SECRET_FILE = "${cfg.cookieSecretFile}";
       };