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: