Add CLI arguments

This commit is contained in:
augustin64 2022-05-23 16:54:04 +02:00
parent f904482199
commit 7a0182b5a9
3 changed files with 15 additions and 3 deletions

3
.gitignore vendored
View File

@ -5,4 +5,5 @@
.cache
.test-cache
.vscode
*.bin
*.bin
app-secret

View File

@ -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():

12
src/parallel/client.py Normal file → Executable file
View File

@ -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)