diff --git a/config.py b/config.py index 29e6f07..62eab32 100644 --- a/config.py +++ b/config.py @@ -9,3 +9,7 @@ DATA_LOCATION = "/tmp/123" DEST_SHRUNK = "image/" # move originals here (needs to exist) DEST_ORIGINAL = "original/" + +# upload interface credentials +CRED_USERNAME="changeme" +CRED_PASSWORD="CHANGEME" \ No newline at end of file diff --git a/main.py b/main.py index 6815ffd..a6f68cc 100644 --- a/main.py +++ b/main.py @@ -11,7 +11,14 @@ import zipfile # Global settings of this program # ./config.py -from config import DB_LOCATION, DATA_LOCATION, DEST_SHRUNK, DEST_ORIGINAL +from config import ( + DB_LOCATION, + DATA_LOCATION, + DEST_SHRUNK, + DEST_ORIGINAL, + CRED_USERNAME, + CRED_PASSWORD, +) # our own util for photo upload and processing @@ -199,8 +206,8 @@ async def upload_pictures( Пока исходим из предположения, что только я буду загружать фотографии. """ # check authenticity - correct_username = compare_digest(credentials.username, "1") - correct_password = compare_digest(credentials.password, "1") + correct_username = compare_digest(credentials.username, CRED_USERNAME) + correct_password = compare_digest(credentials.password, CRED_PASSWORD) if not (correct_username and correct_password): return JSONResponse(status_code=401) # slurp the zip