Добавил возможность указывать токен через переменную среды
This commit is contained in:
7
main.py
7
main.py
@@ -32,9 +32,10 @@ def get_db():
|
|||||||
security = HTTPBearer()
|
security = HTTPBearer()
|
||||||
|
|
||||||
|
|
||||||
TOKEN: str = None
|
TOKEN: str = os.environ.get("BUILD_INC_TOKEN", None)
|
||||||
THIS_SCRIPT_PATH = os.path.dirname(os.path.abspath(__file__))
|
if TOKEN is None:
|
||||||
with open(os.path.join(THIS_SCRIPT_PATH, "token.json"), 'r') as f:
|
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)
|
t = json.load(f)
|
||||||
TOKEN = t["auth.token"]
|
TOKEN = t["auth.token"]
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user