31 lines
773 B
Python
31 lines
773 B
Python
import os
|
|
from dotenv import load_dotenv
|
|
|
|
|
|
ENV_FILE = ".env"
|
|
|
|
|
|
def check_env_file():
|
|
return os.path.exists(ENV_FILE)
|
|
|
|
|
|
def create_env_file():
|
|
print("Файл .env отсутствует и будет создан автоматически.")
|
|
|
|
token = input("Введите TOKEN: ")
|
|
lock_ip = input("Введите LOCK_IP: ")
|
|
card_id = input("Введите CARD_ID: ")
|
|
auth_api = input("Введите AUTH_API: ")
|
|
|
|
with open(ENV_FILE, "w") as f:
|
|
f.write(f"TOKEN={token}\n")
|
|
f.write(f"LOCK_IP={lock_ip}\n")
|
|
f.write(f"CARD_ID={card_id}\n")
|
|
f.write(f"AUTH_API={auth_api}\n")
|
|
|
|
print("Файл .env создан. Происходит запуск приложения")
|
|
|
|
|
|
def load_env():
|
|
load_dotenv()
|