env angepasst

This commit is contained in:
Bastian Wagner
2026-05-05 20:08:15 +02:00
parent 8d07939527
commit e0ea9efe92
6 changed files with 20 additions and 36 deletions

View File

@@ -1,5 +1,3 @@
MYWHOOSH_EMAIL=
MYWHOOSH_PASSWORD=
GARMIN_EMAIL=
GARMIN_PASSWORD=
@@ -7,9 +5,6 @@ POLL_INTERVAL_SECONDS=3600
DATA_DIR=/data
LOG_LEVEL=INFO
DRY_RUN=true
DASHBOARD_ENABLED=true
DASHBOARD_BIND=0.0.0.0
DASHBOARD_PORT=8080
MYWHOOSH_LOGIN_URL=https://www.event.mywhoosh.com/login/
MYWHOOSH_ACTIVITY_URL=https://event.mywhoosh.com/user/activities
@@ -17,7 +12,6 @@ MYWHOOSH_HEADLESS=true
MYWHOOSH_BROWSER_STATE_DIR=/data/browser
MYWHOOSH_AUTH_STATE_PATH=/data/mywhoosh_auth_state.json
MYWHOOSH_TIMEOUT_SECONDS=45
MYWHOOSH_MAX_DOWNLOADS_PER_RUN=10
MYWHOOSH_DOWNLOAD_TEXT_HINTS=fit,download
MYWHOOSH_ACTIVITIES_BUTTON_TEXT=ACTIVITIES
MYWHOOSH_DOWNLOAD_BUTTON_SELECTOR=.btnDownload

View File

@@ -18,6 +18,26 @@ cp .env.example .env
Edit `.env`, then run:
```sh
docker compose -f docker-compose.debug.yml up --build
```
If this runs on a remote Linux server, keep the default localhost-only port binding and tunnel it:
```sh
ssh -L 6080:localhost:6080 user@your-server
```
Then open noVNC:
```text
http://localhost:6080/vnc.html
```
Login into your MyWhoosh account with keep me signed in (Important!).
Exit.
Start the production container
```sh
docker compose up -d --build
docker compose logs -f sync
@@ -30,8 +50,6 @@ The default polling interval is hourly.
Required values:
```env
MYWHOOSH_EMAIL=
MYWHOOSH_PASSWORD=
GARMIN_EMAIL=
GARMIN_PASSWORD=
```

View File

@@ -44,8 +44,6 @@ def _required_env(name: str) -> str:
@dataclass(frozen=True)
class Settings:
mywhoosh_email: str
mywhoosh_password: str
garmin_email: str
garmin_password: str
@@ -59,15 +57,11 @@ class Settings:
db_path: Path
log_level: str
dry_run: bool
dashboard_enabled: bool
dashboard_bind: str
dashboard_port: int
mywhoosh_login_url: str
mywhoosh_activity_url: str
mywhoosh_headless: bool
mywhoosh_timeout_seconds: int
mywhoosh_max_downloads_per_run: int
mywhoosh_download_text_hints: list[str]
mywhoosh_activities_button_text: str
mywhoosh_download_button_selector: str
@@ -89,8 +83,6 @@ class Settings:
data_dir = Path(os.getenv("DATA_DIR", "/data"))
return cls(
mywhoosh_email=_required_env("MYWHOOSH_EMAIL"),
mywhoosh_password=_required_env("MYWHOOSH_PASSWORD"),
garmin_email=_required_env("GARMIN_EMAIL"),
garmin_password=_required_env("GARMIN_PASSWORD"),
poll_interval_seconds=_int_env("POLL_INTERVAL_SECONDS", 3600),
@@ -114,9 +106,6 @@ class Settings:
db_path=Path(os.getenv("STATE_DB", str(data_dir / "state.sqlite3"))),
log_level=os.getenv("LOG_LEVEL", "INFO").upper(),
dry_run=_bool_env("DRY_RUN", False),
dashboard_enabled=_bool_env("DASHBOARD_ENABLED", True),
dashboard_bind=os.getenv("DASHBOARD_BIND", "0.0.0.0"),
dashboard_port=_int_env("DASHBOARD_PORT", 8080),
mywhoosh_login_url=os.getenv(
"MYWHOOSH_LOGIN_URL", "https://www.mywhoosh.com/login/"
),
@@ -125,9 +114,6 @@ class Settings:
),
mywhoosh_headless=_bool_env("MYWHOOSH_HEADLESS", True),
mywhoosh_timeout_seconds=_int_env("MYWHOOSH_TIMEOUT_SECONDS", 45),
mywhoosh_max_downloads_per_run=_int_env(
"MYWHOOSH_MAX_DOWNLOADS_PER_RUN", 10
),
mywhoosh_download_text_hints=_csv_env(
"MYWHOOSH_DOWNLOAD_TEXT_HINTS", ["fit", "download"]
),

View File

@@ -93,8 +93,6 @@ class MyWhooshCrawler:
downloaded: list[DownloadedActivity] = []
for candidate in candidates:
if len(downloaded) >= self.settings.mywhoosh_max_downloads_per_run:
break
if should_skip_source(candidate.source_ref):
logger.debug("Skipping already terminal source %s", candidate.source_ref)
continue
@@ -136,10 +134,6 @@ class MyWhooshCrawler:
password_selector = 'input[type="password"], input[autocomplete="current-password"]'
try:
await page.locator(email_selector).first.fill(self.settings.mywhoosh_email)
await page.locator(password_selector).first.fill(
self.settings.mywhoosh_password
)
await self._dismiss_cookie_banner(page)
submit = page.locator(

View File

@@ -22,14 +22,10 @@ def settings(tmp_path: Path) -> Settings:
db_path=tmp_path / "state.sqlite3",
log_level="INFO",
dry_run=False,
dashboard_enabled=True,
dashboard_bind="127.0.0.1",
dashboard_port=8080,
mywhoosh_login_url="https://www.mywhoosh.com/login/",
mywhoosh_activity_url="https://www.mywhoosh.com/profile/",
mywhoosh_headless=True,
mywhoosh_timeout_seconds=1,
mywhoosh_max_downloads_per_run=10,
mywhoosh_download_text_hints=["fit", "download"],
mywhoosh_activities_button_text="ACTIVITIES",
mywhoosh_download_button_selector=".btnDownload",

View File

@@ -4,7 +4,6 @@ from mywhoosh_garmin_sync.config import Settings
def test_settings_from_env(monkeypatch, tmp_path):
monkeypatch.setenv("MYWHOOSH_EMAIL", "whoosh@example.com")
monkeypatch.setenv("MYWHOOSH_PASSWORD", "whoosh-pass")
monkeypatch.setenv("GARMIN_EMAIL", "garmin@example.com")
monkeypatch.setenv("GARMIN_PASSWORD", "garmin-pass")
@@ -20,9 +19,6 @@ def test_settings_from_env(monkeypatch, tmp_path):
assert settings.raw_dir == tmp_path / "raw"
assert settings.dry_run is True
assert settings.poll_interval_seconds == 123
assert settings.dashboard_enabled is True
assert settings.dashboard_bind == "0.0.0.0"
assert settings.dashboard_port == 8080
assert settings.target_garmin_product_id == 3578
assert settings.target_garmin_serial_number == 123456
assert settings.mywhoosh_manual_login_wait_seconds == 900