commit 35c517e6ab2b421a652371a8aa212111067d1f5b
parent d587976343bae3ffa5af5471ccdb6857778b48dc
Author: MS <ms@taler.net>
Date: Mon, 17 May 2021 20:15:04 +0200
let bootstrap create the token file
Diffstat:
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/bin/taler-deployment b/bin/taler-deployment
@@ -57,6 +57,7 @@ export TALER_COVERAGE={coverage}
export TALER_ENV_FRONTENDS_APITOKEN="$(cat ~/merchant_auth_token)"
"""
+TOKEN_FILE = "~/merchant_auth_token"
@dataclass
class Repo:
@@ -100,6 +101,8 @@ currmap = {
"tanker": "SEK"
}
+def generate_apitoken():
+ return "secret-token:" + ''.join(random.choices(ascii_letters + ascii_uppercase, k=10))
def update_checkout(r: Repo, p: Path):
"""Clean the repository's working directory and
@@ -685,10 +688,11 @@ def bootstrap() -> None:
path_list.insert(0, local_path)
if deployment_path not in path_list:
path_list.insert(0, deployment_path)
- apitoken = load_apitoken()
- if not apitoken:
- print("Please create ~/merchant_auth_token (taler-deployment-auth-token can help).")
- return 1
+
+ if not os.path.isfile(TOKEN_FILE):
+ with open(TOKEN_FILE) as f:
+ f.write(generate_apitoken())
+
with (home / "activate").open("w") as f:
f.write(
activate_template.format(