Compare commits
No commits in common. "317cf04b16ebeb172ca35d0c4c79dee3cde424b1" and "e5adaf85269a3b1e7701580036f2b9ec3dfd1598" have entirely different histories.
317cf04b16
...
e5adaf8526
|
|
@ -5,4 +5,3 @@ lz4
|
||||||
websockets
|
websockets
|
||||||
pydantic
|
pydantic
|
||||||
aiosqlite
|
aiosqlite
|
||||||
python-dotenv
|
|
||||||
|
|
@ -1,7 +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):
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue