AW_PROFILE env var is ignored: Python aw-server always starts in the default profile

Aperta
#234 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 5 giorni

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
68/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
python
Ambito
cli

Direzione di ricerca

Start in aw_server/main.py, where resolve_profile(args.profile, args.testing) only reads the CLI flag and export_profile(profile) then overwrites AW_PROFILE with default. Make the resolver fall back to the AW_PROFILE env var when --profile is absent, as aw-server-rust does. Done when AW_PROFILE=research aw-server reports the research profile on /api/0/info and uses the research data directory; the aw-qt --profile qa port issue can be split into a follow-up.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

The directories docs say to set AW_PROFILE=<name> for each module you start separately. The Python aw-server ignores it. aw-server-rust and the watchers honour it, so a profile set by env var splits across two data directories.

Repro (v0.14.3 linux release, isolated XDG_* dirs):

AW_PROFILE=research aw-server --port 5652 &
AW_PROFILE=research aw-server-rust --port 5651 &
curl -s localhost:5651/api/0/info   # ... "profile":"research"
curl -s localhost:5652/api/0/info   # ... "profile": "default"
ls $XDG_DATA_HOME                   # activitywatch  activitywatch-research

aw-server --profile research works, so the bug is only in the env-var path.

Cause: aw_server/main.py calls resolve_profile(args.profile, args.testing), which looks only at the CLI flags, and export_profile(profile) then overwrites AW_PROFILE with default. The env var never reaches the resolver.

Impact: a separately started Python server lands in the default profile's database and port (5600) while its watchers write to the named profile. During the docs check, an aw-qt --profile qa start also brought the bundled Python aw-server up in the default profile (Using database file: .../activitywatch/aw-server/..., Port 5600 is in use), even with a port set in the profile's aw-server.toml. That part has not been isolated yet. It may be the same root cause, or separate aw-qt argument passing.

Expected: with no --profile flag, fall back to AW_PROFILE, as aw-server-rust does.

Found during a docs-vs-reality pass of the getting-started, directories and configuration pages.

Lingua principale
Python
Stelle
129
Fork
105
Merge medio
4g 23h
PR unite (30g)
17

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di ActivityWatch/aw-server

Tutte le issue di ActivityWatch/aw-server

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.