summaryrefslogtreecommitdiffstats
path: root/lass/2configs/codimd.nix
diff options
context:
space:
mode:
authormakefu <github@syntax-fehler.de>2021-11-07 14:31:25 +0100
committermakefu <github@syntax-fehler.de>2021-11-07 14:31:25 +0100
commit597f546e9833b2569ee6ec540f688f7fb95bd26c (patch)
treee7393bb0aea4faee24e85e63d82843bd3b9a0bac /lass/2configs/codimd.nix
parent9392c355ad5198346313ef0972db1910c10d17bf (diff)
parent0e668121a1388914f33a6546c2f63adc212a38c4 (diff)
Merge remote-tracking branch 'lass/master'
Diffstat (limited to 'lass/2configs/codimd.nix')
-rw-r--r--lass/2configs/codimd.nix45
1 files changed, 35 insertions, 10 deletions
diff --git a/lass/2configs/codimd.nix b/lass/2configs/codimd.nix
index d29a65210..271dcfca4 100644
--- a/lass/2configs/codimd.nix
+++ b/lass/2configs/codimd.nix
@@ -1,27 +1,52 @@
{ config, pkgs, lib, ... }:
with import <stockholm/lib>;
-{
- services.nginx.virtualHosts.codimd = {
+let
+ domain = "pad.lassul.us";
+in {
+
+ # redirect legacy domain to new one
+ services.nginx.virtualHosts."codi.lassul.us" = {
enableACME = true;
addSSL = true;
- serverName = "codi.lassul.us";
- locations."/".extraConfig = ''
- client_max_body_size 4G;
- proxy_set_header Host $host;
- proxy_pass http://localhost:3091;
- '';
+ locations."/".return = "301 https://${domain}\$request_uri";
+ };
+
+ services.nginx.virtualHosts.${domain} = {
+ enableACME = true;
+ forceSSL = true;
+ locations."/" = {
+ proxyPass = "https://localhost:3091";
+ proxyWebsockets = true;
+ };
+ };
+
+ security.acme.certs.${domain}.group = "hedgecert";
+ users.groups.hedgecert.members = [ "codimd" "nginx" ];
+
+ security.dhparams = {
+ enable = true;
+ params.hedgedoc = {};
};
services.hedgedoc = {
enable = true;
- configuration.allowOrigin = [ "*" ];
+ configuration.allowOrigin = [ domain ];
configuration = {
db = {
dialect = "sqlite";
storage = "/var/lib/codimd/db.codimd.sqlite";
- useCDN = false;
};
+ useCDN = false;
port = 3091;
+ domain = domain;
+ allowFreeURL = true;
+
+ useSSL = true;
+ protocolUseSSL = true;
+ sslCAPath = [ "/etc/ssl/certs/ca-certificates.crt" ];
+ sslCertPath = "/var/lib/acme/${domain}/cert.pem";
+ sslKeyPath = "/var/lib/acme/${domain}/key.pem";
+ dhParamPath = config.security.dhparams.params.hedgedoc.path;
};
};
}