dfcode-remote 0.1.0__tar.gz → 0.2.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {dfcode_remote-0.1.0 → dfcode_remote-0.2.0}/PKG-INFO +1 -1
- {dfcode_remote-0.1.0 → dfcode_remote-0.2.0}/dfcode_remote/__init__.py +1 -1
- {dfcode_remote-0.1.0 → dfcode_remote-0.2.0}/dfcode_remote/utils/config.py +26 -3
- {dfcode_remote-0.1.0 → dfcode_remote-0.2.0}/dfcode_remote.egg-info/PKG-INFO +1 -1
- {dfcode_remote-0.1.0 → dfcode_remote-0.2.0}/pyproject.toml +1 -1
- {dfcode_remote-0.1.0 → dfcode_remote-0.2.0}/README.md +0 -0
- {dfcode_remote-0.1.0 → dfcode_remote-0.2.0}/dfcode_remote/__main__.py +0 -0
- {dfcode_remote-0.1.0 → dfcode_remote-0.2.0}/dfcode_remote/cli.py +0 -0
- {dfcode_remote-0.1.0 → dfcode_remote-0.2.0}/dfcode_remote/dfcode_client/__init__.py +0 -0
- {dfcode_remote-0.1.0 → dfcode_remote-0.2.0}/dfcode_remote/dfcode_client/client.py +0 -0
- {dfcode_remote-0.1.0 → dfcode_remote-0.2.0}/dfcode_remote/dfcode_client/sse.py +0 -0
- {dfcode_remote-0.1.0 → dfcode_remote-0.2.0}/dfcode_remote/dfcode_client/types.py +0 -0
- {dfcode_remote-0.1.0 → dfcode_remote-0.2.0}/dfcode_remote/lark_client/__init__.py +0 -0
- {dfcode_remote-0.1.0 → dfcode_remote-0.2.0}/dfcode_remote/lark_client/bot.py +0 -0
- {dfcode_remote-0.1.0 → dfcode_remote-0.2.0}/dfcode_remote/lark_client/card_builder.py +0 -0
- {dfcode_remote-0.1.0 → dfcode_remote-0.2.0}/dfcode_remote/lark_client/card_service.py +0 -0
- {dfcode_remote-0.1.0 → dfcode_remote-0.2.0}/dfcode_remote/lark_client/event_listener.py +0 -0
- {dfcode_remote-0.1.0 → dfcode_remote-0.2.0}/dfcode_remote/lark_client/handler.py +0 -0
- {dfcode_remote-0.1.0 → dfcode_remote-0.2.0}/dfcode_remote/utils/__init__.py +0 -0
- {dfcode_remote-0.1.0 → dfcode_remote-0.2.0}/dfcode_remote/utils/markdown.py +0 -0
- {dfcode_remote-0.1.0 → dfcode_remote-0.2.0}/dfcode_remote/utils/persistence.py +0 -0
- {dfcode_remote-0.1.0 → dfcode_remote-0.2.0}/dfcode_remote.egg-info/SOURCES.txt +0 -0
- {dfcode_remote-0.1.0 → dfcode_remote-0.2.0}/dfcode_remote.egg-info/dependency_links.txt +0 -0
- {dfcode_remote-0.1.0 → dfcode_remote-0.2.0}/dfcode_remote.egg-info/entry_points.txt +0 -0
- {dfcode_remote-0.1.0 → dfcode_remote-0.2.0}/dfcode_remote.egg-info/requires.txt +0 -0
- {dfcode_remote-0.1.0 → dfcode_remote-0.2.0}/dfcode_remote.egg-info/top_level.txt +0 -0
- {dfcode_remote-0.1.0 → dfcode_remote-0.2.0}/setup.cfg +0 -0
- {dfcode_remote-0.1.0 → dfcode_remote-0.2.0}/tests/test_card_builder.py +0 -0
- {dfcode_remote-0.1.0 → dfcode_remote-0.2.0}/tests/test_card_service.py +0 -0
- {dfcode_remote-0.1.0 → dfcode_remote-0.2.0}/tests/test_dfcode_client.py +0 -0
- {dfcode_remote-0.1.0 → dfcode_remote-0.2.0}/tests/test_event_listener.py +0 -0
- {dfcode_remote-0.1.0 → dfcode_remote-0.2.0}/tests/test_handler.py +0 -0
- {dfcode_remote-0.1.0 → dfcode_remote-0.2.0}/tests/test_markdown.py +0 -0
- {dfcode_remote-0.1.0 → dfcode_remote-0.2.0}/tests/test_persistence.py +0 -0
- {dfcode_remote-0.1.0 → dfcode_remote-0.2.0}/tests/test_sse.py +0 -0
- {dfcode_remote-0.1.0 → dfcode_remote-0.2.0}/tests/test_types.py +0 -0
|
@@ -1,9 +1,23 @@
|
|
|
1
1
|
import os
|
|
2
|
+
import sys
|
|
2
3
|
from dataclasses import dataclass, field
|
|
4
|
+
from pathlib import Path
|
|
3
5
|
|
|
4
6
|
from dotenv import load_dotenv
|
|
5
7
|
|
|
6
8
|
|
|
9
|
+
def _config_dir() -> Path:
|
|
10
|
+
"""Return platform-appropriate config directory."""
|
|
11
|
+
if sys.platform == "win32":
|
|
12
|
+
base = Path(os.environ.get("APPDATA", Path.home() / "AppData" / "Roaming"))
|
|
13
|
+
else:
|
|
14
|
+
base = Path(os.environ.get("XDG_CONFIG_HOME", Path.home() / ".config"))
|
|
15
|
+
return base / "dfcode-remote"
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
CONFIG_DIR = _config_dir()
|
|
19
|
+
|
|
20
|
+
|
|
7
21
|
@dataclass
|
|
8
22
|
class Config:
|
|
9
23
|
"""Application configuration loaded from .env and environment variables."""
|
|
@@ -19,11 +33,20 @@ class Config:
|
|
|
19
33
|
|
|
20
34
|
@staticmethod
|
|
21
35
|
def load() -> "Config":
|
|
22
|
-
"""Load config from .env
|
|
36
|
+
"""Load config from .env files and environment variables.
|
|
23
37
|
|
|
24
|
-
|
|
38
|
+
Priority (highest to lowest):
|
|
39
|
+
1. Environment variables
|
|
40
|
+
2. .env in current working directory
|
|
41
|
+
3. ~/.config/dfcode-remote/.env
|
|
25
42
|
"""
|
|
26
|
-
|
|
43
|
+
# Load global config first (lower priority)
|
|
44
|
+
global_env = CONFIG_DIR / ".env"
|
|
45
|
+
if global_env.exists():
|
|
46
|
+
load_dotenv(global_env)
|
|
47
|
+
|
|
48
|
+
# Load local .env (overrides global)
|
|
49
|
+
load_dotenv(override=True)
|
|
27
50
|
|
|
28
51
|
raw_users = os.getenv("ALLOWED_USERS", "")
|
|
29
52
|
allowed = [u.strip() for u in raw_users.split(",") if u.strip()]
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|