mirror of
https://github.com/openmax-server/server.git
synced 2026-05-23 03:51:43 +03:00
refactor: убрал лишние импорты
This commit is contained in:
@@ -1,9 +1,7 @@
|
|||||||
pyTelegramBotAPI
|
pyTelegramBotAPI
|
||||||
aiomysql
|
aiomysql
|
||||||
python-dotenv
|
|
||||||
msgpack
|
msgpack
|
||||||
lz4
|
lz4
|
||||||
websockets
|
websockets
|
||||||
pydantic
|
pydantic
|
||||||
aiohttp
|
|
||||||
aiosqlite
|
aiosqlite
|
||||||
@@ -1,6 +1,22 @@
|
|||||||
import os
|
import os
|
||||||
from dotenv import load_dotenv
|
from pathlib import Path
|
||||||
load_dotenv()
|
|
||||||
|
def _load_dotenv():
|
||||||
|
env_path = Path(".env")
|
||||||
|
if not env_path.is_file():
|
||||||
|
return
|
||||||
|
with open(env_path, encoding="utf-8") as f:
|
||||||
|
for line in f:
|
||||||
|
line = line.strip()
|
||||||
|
if not line or line.startswith("#") or "=" not in line:
|
||||||
|
continue
|
||||||
|
key, _, value = line.partition("=")
|
||||||
|
key = key.strip()
|
||||||
|
value = value.strip().strip("\"'")
|
||||||
|
if key and key not in os.environ:
|
||||||
|
os.environ[key] = value
|
||||||
|
|
||||||
|
_load_dotenv()
|
||||||
|
|
||||||
class ServerConfig:
|
class ServerConfig:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
|
|||||||
Reference in New Issue
Block a user