diff options
author | MS <ms@taler.net> | 2021-05-17 20:15:04 +0200 |
---|---|---|
committer | MS <ms@taler.net> | 2021-05-17 20:15:04 +0200 |
commit | 35c517e6ab2b421a652371a8aa212111067d1f5b (patch) | |
tree | 66c9cf7bc7a7aa2bc940f20691dcfa404e2047a1 /bin/taler-deployment | |
parent | d587976343bae3ffa5af5471ccdb6857778b48dc (diff) | |
download | deployment-35c517e6ab2b421a652371a8aa212111067d1f5b.tar.gz deployment-35c517e6ab2b421a652371a8aa212111067d1f5b.tar.bz2 deployment-35c517e6ab2b421a652371a8aa212111067d1f5b.zip |
let bootstrap create the token file
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( |