diff options
author | Vika <vika@fireburn.ru> | 2021-12-06 20:39:04 +0300 |
---|---|---|
committer | Vika <vika@fireburn.ru> | 2021-12-06 20:42:50 +0300 |
commit | 9a9776230ce8d12d305ca8db19cc76f20ae40926 (patch) | |
tree | 26d1e166ae68825e55084b43c52afcb446521b11 /flake.nix | |
parent | 913779655c1feddc55d37bebbdd7df87eb7c9c0f (diff) | |
download | kittybox-9a9776230ce8d12d305ca8db19cc76f20ae40926.tar.zst |
Added support for IndieAuth client sign in
This will allow readers to view private posts intended just for them. Additionally fixed bugs in patterns due to which webmentions might not have been sent.
Diffstat (limited to 'flake.nix')
-rw-r--r-- | flake.nix | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/flake.nix b/flake.nix index 0b0e039..4366190 100644 --- a/flake.nix +++ b/flake.nix @@ -124,6 +124,12 @@ example = "/run/secrets/kittybox-shared-secret"; description = "A shared secret that will, when passed, allow unlimited editing access to database. Keep it safe."; }; + cookieSecretFile = mkOption { + 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."; + }; }; }; config = lib.mkIf cfg.enable { @@ -139,6 +145,7 @@ cfg.authorizationEndpoint cfg.internalTokenFile cfg.bind cfg.port + cfg.cookieSecretFile ]; environment = { @@ -151,6 +158,7 @@ #REDIS_URI = if (cfg.redisUri == null) then "redis://127.0.0.1:6379/" else cfg.redisUri; BACKEND_URI = cfg.backendUri; RUST_LOG = "${cfg.logLevel}"; + COOKIE_SECRET_FILE = "${cfg.cookieSecretFile}"; }; script = '' @@ -159,6 +167,9 @@ export KITTYBOX_INTERNAL_TOKEN=$(${pkgs.coreutils}/bin/cat ${cfg.internalTokenFile}) fi ''} + if [[ ${cfg.cookieSecretFile} == /var/lib/kittybox/cookie_secret_key && ! -f /var/lib/kittybox/cookie_secret_key ]]; then + cat /dev/urandom | tr -Cd '[:alnum:]' | head -c 128 > /var/lib/kittybox/cookie_secret_key + fi exec ${cfg.package}/bin/kittybox ''; |