commit b035f10697888c1f72c9eaf3bde8d3753b3df4c9
parent fe46808d343285b8e6efdd4c39ec6e4589ba6e38
Author: MS <ms@taler.net>
Date: Fri, 24 Jul 2020 14:14:58 +0200
tips configuration
Diffstat:
1 file changed, 33 insertions(+), 0 deletions(-)
diff --git a/bin/taler-config-tips b/bin/taler-config-tips
@@ -0,0 +1,33 @@
+#!/usr/bin/env python3
+
+import requests
+from os import environ
+from sys import exit
+from urllib.parse import urljoin
+
+def expectResponse(response, expected_status_codes):
+ if response.status_code not in expected_status_codes:
+ print("Configuration failed on URL: {}".format(response.url))
+ print(response.text)
+ exit(1)
+ # Allows for finer grained checks.
+ return response
+
+TALER_ENV_NAME = environ.get("TALER_ENV_NAME")
+if not MERCHANT_BACKEND_BASE_URL:
+ print("TALER_ENV_NAME not defined. Please source the ~/activate file.")
+ exit(1)
+MERCHANT_BACKEND = f"https://backend.{TALER_ENV_NAME}.taler.net/"
+TALER_CONFIG_CURRENCY = environ.get("TALER_CONFIG_CURRENCY", "EUR")
+
+expectResponse(
+ post(
+ urljoin(MERCHANT_BACKEND, "instances/survey/private/reserves"),
+ json=dict(
+ initial_balance=f"{TALER_CONFIG_CURRENCY}:50",
+ exchange_url=f"https://exchange.{TALER_ENV_NAME}.taler.net/",
+ wire_method="x-taler-bank"
+ )
+ ),
+ [200]
+)