From 4afeef1eb4c0adc062d7502130d32cbb99f6a64e Mon Sep 17 00:00:00 2001
From: jehad <jehad@leastauthority.com>
Date: Wed, 22 Mar 2023 06:34:47 +0100
Subject: [PATCH] With configurable token count

Co-authored-by: Benoit Donneaux <benoit@leastauthority.com>
Signed-off-by: Benoit Donneaux <benoit@leastauthority.com>
---
 morph/grid/hro-cloud/config.json |  1 +
 morph/lib/issuer.nix             | 13 ++++++++++++-
 2 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/morph/grid/hro-cloud/config.json b/morph/grid/hro-cloud/config.json
index dca2b2ec..191e3751 100644
--- a/morph/grid/hro-cloud/config.json
+++ b/morph/grid/hro-cloud/config.json
@@ -4,6 +4,7 @@
 , "publicKeyPath": "./public-keys"
 , "monitoringvpnEndpoint": "monitoring.deerfield.leastauthority.com:51820"
 , "passValue": 1000000
+, "tokensPerVoucher": 150000
 , "issuerDomains": [
     "payments.deerfield.leastauthority.com"
   ]
diff --git a/morph/lib/issuer.nix b/morph/lib/issuer.nix
index 86c46a14..66791142 100644
--- a/morph/lib/issuer.nix
+++ b/morph/lib/issuer.nix
@@ -3,7 +3,7 @@
 { lib, config, ...}:
 let
   inherit (config.grid) privateKeyPath;
-  inherit (config.grid.issuer) issuerDomains allowedChargeOrigins;
+  inherit (config.grid.issuer) issuerDomains allowedChargeOrigins tokensPerVoucher;
 in {
   imports = [
     ./monitoringvpn-client.nix
@@ -25,6 +25,16 @@ in {
         to allow.
       '';
     };
+
+    tokensPerVoucher = lib.mkOption {
+      default = null;
+      type = lib.types.nullOr lib.types.int;
+      example = 50000;
+      description = ''
+        If not null, a value to pass to PaymentServer for
+        ``--tokens-per-voucher``.
+      '';
+    };
   };
 
   config = {
@@ -58,6 +68,7 @@ in {
       inherit (config.grid) letsEncryptAdminEmail;
       inherit allowedChargeOrigins;
       domains = issuerDomains;
+      inherit tokensPerVoucher;
     };
 
     services.private-storage.monitoring.exporters.node.enable = true;
-- 
GitLab