summary refs log tree commit diff
diff options
context:
space:
mode:
authorTheArcaneBrony <myrainbowdash949@gmail.com>2023-09-07 21:23:17 +0200
committerTheArcaneBrony <myrainbowdash949@gmail.com>2023-09-07 21:23:17 +0200
commitaba0092ea50e38c73ab87e7c659e9162596fc021 (patch)
treecca9381e70e715dcf41a2d1b1edc6b821a55c559
parentMore container stuff (diff)
downloadRory-Open-Architecture-aba0092ea50e38c73ab87e7c659e9162596fc021.tar.xz
More container stuff
-rwxr-xr-xhost/Rory-nginx/services/containers/pluralcontactbotpoc/services/conduit.nix18
1 files changed, 18 insertions, 0 deletions
diff --git a/host/Rory-nginx/services/containers/pluralcontactbotpoc/services/conduit.nix b/host/Rory-nginx/services/containers/pluralcontactbotpoc/services/conduit.nix
index aa64814..d100f4d 100755
--- a/host/Rory-nginx/services/containers/pluralcontactbotpoc/services/conduit.nix
+++ b/host/Rory-nginx/services/containers/pluralcontactbotpoc/services/conduit.nix
@@ -14,6 +14,24 @@
       allow_registration = false;
     };
   };
+
+  systemd.services.matrix-conduit-reg-token = {
+      description = "Random registration token for Conduit.";
+      before = ["conduit.service"]; # So the registration can be used by Conduit.
+
+      script = ''
+        reg_token=`cat /dev/urandom | tr -dc a-zA-Z0-9 | fold -w 256 | head -n 1`
+        mkdir -p /run/systemd/system/conduit.service.d
+        echo $reg_token > /run/conduit-registration-token
+        echo Environment=\"CONDUIT_REGISTRATION_TOKEN=${reg_token}\" > /run/systemd/system/conduit.service.d/override.conf
+        systemctl daemon-reload
+        systemctl try-restart conduit.service'';
+      serviceConfig = {
+        User = "root";
+        Group = "root";
+      };
+    };
+
   system.stateVersion = "22.11"; # DO NOT EDIT!
 }