From 7af3980323e748b3d77eef64b03db3e25fbe81d6 Mon Sep 17 00:00:00 2001 From: Tessa Walsh Date: Tue, 25 Jun 2024 10:55:29 -0400 Subject: [PATCH] Add billing enabled and sales email to Helm chart and /settings API endpoint (#1873) Backend work for first two tasks of https://github.com/webrecorder/browsertrix/issues/1875 New /billing API endpoint to be added separately once we have a better idea of what data we can get from the payment processor. --- backend/btrixcloud/main.py | 2 ++ backend/test/test_settings.py | 2 ++ chart/templates/configmap.yaml | 4 ++++ chart/values.yaml | 3 +++ 4 files changed, 11 insertions(+) diff --git a/backend/btrixcloud/main.py b/backend/btrixcloud/main.py index 04bcec4d..bdc3e747 100644 --- a/backend/btrixcloud/main.py +++ b/backend/btrixcloud/main.py @@ -68,6 +68,8 @@ def main(): ), "maxPagesPerCrawl": int(os.environ.get("MAX_PAGES_PER_CRAWL", 0)), "maxScale": int(os.environ.get("MAX_CRAWL_SCALE", 3)), + "billingEnabled": is_bool(os.environ.get("BILLING_ENABLED")), + "salesEmail": os.environ.get("SALES_EMAIL"), } invites = init_invites(mdb, email) diff --git a/backend/test/test_settings.py b/backend/test/test_settings.py index a15f012e..2a0425ba 100644 --- a/backend/test/test_settings.py +++ b/backend/test/test_settings.py @@ -16,4 +16,6 @@ def test_settings(): "maxPagesPerCrawl": 4, "maxScale": 3, "defaultPageLoadTimeSeconds": 120, + "billingEnabled": False, + "salesEmail": "sales@webrecorder.org", } diff --git a/chart/templates/configmap.yaml b/chart/templates/configmap.yaml index dfd6bd93..754b09dd 100644 --- a/chart/templates/configmap.yaml +++ b/chart/templates/configmap.yaml @@ -58,6 +58,10 @@ data: MAX_CRAWLER_MEMORY: "{{ .Values.max_crawler_memory }}" + BILLING_ENABLED: "{{ .Values.billing_enabled }}" + + SALES_EMAIL: "{{ .Values.sales_email }}" + --- apiVersion: v1 kind: ConfigMap diff --git a/chart/values.yaml b/chart/values.yaml index a8f7c242..c739f8fc 100644 --- a/chart/values.yaml +++ b/chart/values.yaml @@ -110,6 +110,9 @@ job_memory: "70Mi" profile_browser_idle_seconds: 60 +billing_enabled: false +sales_email: "sales@webrecorder.org" + # if set, print last 'log_failed_crawl_lines' of each failed # crawl pod to backend operator stdout # mostly intended for debugging / testing