From 51823b2c10ea8540777b24dccb4e7d3b422e279b Mon Sep 17 00:00:00 2001 From: Argiris Deligiannidis Date: Sat, 3 Feb 2024 14:00:25 +0200 Subject: [PATCH] Create dotenv token value --- app/dot_env | 1 + app/main.py | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/app/dot_env b/app/dot_env index 07811f4..9448fa4 100644 --- a/app/dot_env +++ b/app/dot_env @@ -5,3 +5,4 @@ DESTINATION = "/var/invoices/" #DESTINATION = "../invoices/" CHUNK_SIZE =1048576 # = 2 ** 20 = 1MB +TOKEN="ZPOclCF5od59SgW6PLM2" diff --git a/app/main.py b/app/main.py index 2349f22..c247083 100644 --- a/app/main.py +++ b/app/main.py @@ -15,6 +15,7 @@ load_dotenv() SERVICE_URL = os.getenv('SERVICE_URL') DESTINATION = os.getenv('DESTINATION') CHUNK_SIZE = int(os.getenv('CHUNK_SIZE')) +env_TOKEN = os.getenv('TOKEN') log = logging.getLogger(__name__) app = FastAPI() @@ -209,7 +210,7 @@ async def create_qr_code(code_content: Optional[str] = None, token: Optional[str Returns: Response: The QR code image as a Response object with media type "image/png". """ - if token == 'ZPOclCF5od59SgW6PLM2': + if token == env_TOKEN: if code_content: qr_image = make_qrcode(code_content) print("{} : QR Created".format(datetime.datetime.now()))