From 706a9586771f3159dc4ed2de13e2959191e2874d Mon Sep 17 00:00:00 2001
From: Florian Sesser <florian@private.storage>
Date: Tue, 3 Aug 2021 16:44:32 +0000
Subject: [PATCH] Make issuer ports configurable

---
 nixos/modules/issuer.nix | 19 ++++++++++++++++---
 1 file changed, 16 insertions(+), 3 deletions(-)

diff --git a/nixos/modules/issuer.nix b/nixos/modules/issuer.nix
index ce1f928b..0db40f19 100644
--- a/nixos/modules/issuer.nix
+++ b/nixos/modules/issuer.nix
@@ -111,6 +111,20 @@ in {
         PaymentServer.  It just controls the CORS headers served.
       '';
     };
+    services.private-storage-issuer.httpPort = lib.mkOption {
+      type = lib.types.int;
+      description = ''
+        The port number for the HTTP endpoint.
+      '';
+      default = 80;
+    };
+    services.private-storage-issuer.httpsPort = lib.mkOption {
+      type = lib.types.int;
+      description = ''
+        The port number for the HTTPs endpoint.
+      '';
+      default = 443;
+    };
   };
 
   config =
@@ -161,13 +175,12 @@ in {
           httpsArgs =
             if cfg.tls
             then
-              "--https-port 443 " +
+              "--https-port ${toString cfg.httpsPort}" +
               "--https-certificate-path ${certroot}/${domain}/cert.pem " +
               "--https-certificate-chain-path ${certroot}/${domain}/chain.pem " +
               "--https-key-path ${certroot}/${domain}/privkey.pem"
             else
-              # Only for automated testing.
-              "--http-port 80";
+              "--http-port ${toString cfg.httpPort}";
 
           prefixOption = s: "--cors-origin=" + s;
           originStrings = map prefixOption cfg.allowedChargeOrigins;
-- 
GitLab