summaryrefslogtreecommitdiff
path: root/bin/taler-config-tips
diff options
context:
space:
mode:
authorMS <ms@taler.net>2020-07-24 14:14:58 +0200
committerMS <ms@taler.net>2020-07-24 14:14:58 +0200
commitb035f10697888c1f72c9eaf3bde8d3753b3df4c9 (patch)
tree7abe0b830b882d687531ba59c62744cae4a3f876 /bin/taler-config-tips
parentfe46808d343285b8e6efdd4c39ec6e4589ba6e38 (diff)
downloaddeployment-b035f10697888c1f72c9eaf3bde8d3753b3df4c9.tar.gz
deployment-b035f10697888c1f72c9eaf3bde8d3753b3df4c9.tar.bz2
deployment-b035f10697888c1f72c9eaf3bde8d3753b3df4c9.zip
tips configuration
Diffstat (limited to 'bin/taler-config-tips')
-rwxr-xr-xbin/taler-config-tips33
1 files changed, 33 insertions, 0 deletions
diff --git a/bin/taler-config-tips b/bin/taler-config-tips
new file mode 100755
index 0000000..fd8a178
--- /dev/null
+++ 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]
+)