From e0ea9efe92c9285c0476ae57b533476487a396b0 Mon Sep 17 00:00:00 2001 From: Bastian Wagner Date: Tue, 5 May 2026 20:08:15 +0200 Subject: [PATCH] env angepasst --- .env.example | 6 ------ README.md | 22 ++++++++++++++++++++-- src/mywhoosh_garmin_sync/config.py | 14 -------------- src/mywhoosh_garmin_sync/mywhoosh.py | 6 ------ tests/conftest.py | 4 ---- tests/test_config.py | 4 ---- 6 files changed, 20 insertions(+), 36 deletions(-) diff --git a/.env.example b/.env.example index 6fe5651..608524d 100644 --- a/.env.example +++ b/.env.example @@ -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 diff --git a/README.md b/README.md index 1d8ec2f..8c76803 100644 --- a/README.md +++ b/README.md @@ -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= ``` diff --git a/src/mywhoosh_garmin_sync/config.py b/src/mywhoosh_garmin_sync/config.py index 218ce3b..186aba9 100644 --- a/src/mywhoosh_garmin_sync/config.py +++ b/src/mywhoosh_garmin_sync/config.py @@ -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"] ), diff --git a/src/mywhoosh_garmin_sync/mywhoosh.py b/src/mywhoosh_garmin_sync/mywhoosh.py index 9841514..ad1c09d 100644 --- a/src/mywhoosh_garmin_sync/mywhoosh.py +++ b/src/mywhoosh_garmin_sync/mywhoosh.py @@ -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( diff --git a/tests/conftest.py b/tests/conftest.py index 26f4b42..ba32946 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -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", diff --git a/tests/test_config.py b/tests/test_config.py index c2566a9..a9f3018 100644 --- a/tests/test_config.py +++ b/tests/test_config.py @@ -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