summaryrefslogtreecommitdiff
path: root/bin/taler-deployment-auth-token
diff options
context:
space:
mode:
authorMS <ms@taler.net>2021-05-17 16:33:11 +0200
committerMS <ms@taler.net>2021-05-17 16:33:11 +0200
commitb0ff994f0303709320d8c210ec64b984f21ac092 (patch)
treead80949cda527b1de65961a99ca920cf4a42a57e /bin/taler-deployment-auth-token
parent5e5b0d13163c62b80e32f4dda1a551bb2982fd2f (diff)
downloaddeployment-b0ff994f0303709320d8c210ec64b984f21ac092.tar.gz
deployment-b0ff994f0303709320d8c210ec64b984f21ac092.tar.bz2
deployment-b0ff994f0303709320d8c210ec64b984f21ac092.zip
preferring loading API token from file
Diffstat (limited to 'bin/taler-deployment-auth-token')
-rw-r--r--bin/taler-deployment-auth-token31
1 files changed, 31 insertions, 0 deletions
diff --git a/bin/taler-deployment-auth-token b/bin/taler-deployment-auth-token
new file mode 100644
index 0000000..bd638fd
--- /dev/null
+++ b/bin/taler-deployment-auth-token
@@ -0,0 +1,31 @@
+#!/usr/bin/env python3
+
+# This file is part of GNU Taler.
+#
+# GNU Taler is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# GNU Taler is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GNU Taler. If not, see <https://www.gnu.org/licenses/>.
+
+import random
+import os
+
+TOKEN_FILE = "~/merchant_auth_token"
+
+def generate_apitoken():
+ return "secret-token:" + ''.join(random.choices(ascii_letters + ascii_uppercase, k=10))
+
+if os.path.isfile(TOKEN_FILE):
+ print("~/merchant_auth_token exists already. Not overwriting it!")
+ return 0
+
+with open(TOKEN_FILE) as f:
+ f.write(generate_apitoken())