From 89ce537d1772c8496ca56be8f67acfb71ae35826 Mon Sep 17 00:00:00 2001 From: "Leonov Artur (Depish)" Date: Mon, 16 Dec 2024 12:59:11 +0300 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=B8=D0=BB=20?= =?UTF-8?q?=D0=B2=D0=BE=D0=B7=D0=BC=D0=BE=D0=B6=D0=BD=D0=BE=D1=81=D1=82?= =?UTF-8?q?=D1=8C=20=D1=83=D0=BA=D0=B0=D0=B7=D1=8B=D0=B2=D0=B0=D1=82=D1=8C?= =?UTF-8?q?=20=D1=82=D0=BE=D0=BA=D0=B5=D0=BD=20=D1=87=D0=B5=D1=80=D0=B5?= =?UTF-8?q?=D0=B7=20=D0=BF=D0=B5=D1=80=D0=B5=D0=BC=D0=B5=D0=BD=D0=BD=D1=83?= =?UTF-8?q?=D1=8E=20=D1=81=D1=80=D0=B5=D0=B4=D1=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/main.py b/main.py index af1b37c..855c23c 100644 --- a/main.py +++ b/main.py @@ -32,12 +32,13 @@ def get_db(): security = HTTPBearer() -TOKEN: str = None -THIS_SCRIPT_PATH = os.path.dirname(os.path.abspath(__file__)) -with open(os.path.join(THIS_SCRIPT_PATH, "token.json"), 'r') as f: - t = json.load(f) - TOKEN = t["auth.token"] - +TOKEN: str = os.environ.get("BUILD_INC_TOKEN", None) +if TOKEN is None: + THIS_SCRIPT_PATH = os.path.dirname(os.path.abspath(__file__)) + with open(os.path.join(THIS_SCRIPT_PATH, "token.json"), 'r') as f: + t = json.load(f) + TOKEN = t["auth.token"] + def get_current_user(credentials: HTTPAuthorizationCredentials = Security(security)): if credentials.credentials != TOKEN: