diff options
Diffstat (limited to 'bin/taler-deployment')
-rwxr-xr-x | bin/taler-deployment | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/bin/taler-deployment b/bin/taler-deployment index ee658d6..e3ce6bb 100755 --- 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( |