diff --git a/.gitignore b/.gitignore index 7205509..2580887 100644 --- a/.gitignore +++ b/.gitignore @@ -5,4 +5,5 @@ .cache .test-cache .vscode -*.bin \ No newline at end of file +*.bin +app-secret \ No newline at end of file diff --git a/src/parallel/app.py b/src/parallel/app.py index 391ca97..0bf2242 100644 --- a/src/parallel/app.py +++ b/src/parallel/app.py @@ -47,6 +47,9 @@ app = Flask(__name__) app.config["SECRET_KEY"] = token_urlsafe(40) print(f" * Secret: {SECRET}") +with open("app-secret", "w", encoding="utf8") as file: + file.write(SECRET) + @app.route("/authenticate", methods=["POST"]) def authenticate(): diff --git a/src/parallel/client.py b/src/parallel/client.py old mode 100644 new mode 100755 index 5a2de38..6e429b3 --- a/src/parallel/client.py +++ b/src/parallel/client.py @@ -15,8 +15,16 @@ import requests CACHE = "/tmp/parallel/client_cache" # Replace with an absolute path DELTA = os.path.join(CACHE, "delta_shared.bin") RESEAU = os.path.join(CACHE, "reseau_shared.bin") -SECRET = input("SECRET : ") -HOST = input("HOST : ") + +if len(sys.argv) > 1: + HOST = sys.argv[1] +else: + HOST = input("HOST : ") + +if len(sys.argv) > 2: + SECRET = sys.argv[2] +else: + SECRET = input("SECRET : ") session = requests.Session() os.makedirs(CACHE, exist_ok=True)