withings-sync: Storing garth session in `./garmin_session` causes problems when syncing multiple users
Commit 64d8ec1b31 introduced storing the garth session in the directory ./garmin_session which in principle is a nice addition. But sadly this causes problems in my setup. I’m syncing the measurements of all family members from Withings to Garmin by repeatedly calling withings-sync with changed environment variables WITHINGS_USER, GARMIN_USERNAME and GARMIN_PASSWORD.
By introducing the session saving all Withings data is pushed to the Garmin account that had the first successful login.
It would be nice if the session information is stored in the already existing json file specified with WITHINGS_USER using the dumps and loads functions of garth. Alternatively an extra environment variable and/or an argument could be introduced to specify the location of the session data.
FYI @jrast @matin
About this issue
- Original URL
- State: open
- Created 9 months ago
- Comments: 15 (12 by maintainers)
Commits related to this issue
- Fix for #141: Support for multiple garmin users — committed to jrast/withings-sync by jrast 9 months ago
- Merge pull request #144 from jrast/garmin-multi-user Fix for #141: Support for multiple garmin users — committed to jaroslawhartman/withings-sync by longstone 9 months ago
I created a quick draft for multiple garmin users, where the session storage location can be set by the
GARMIN_SESSIONenvironment variable.Regarding multi-user support in general: In your approach the
{user}in/root/.withings-sync/{user}/...seems to be handled by withings-sync. I don’t know if this is the right approach. But placing all session information (withings & garmin) in a single folder sounds like a good idea. So a directory.withings-sync, defaulting to~/.withings-syncand configurable by the environment variableWITHINGS_SYNC_SESSION(for example), would allready allow a clean multi-user experience.What about the withings user info? do we need to describe which user matches with which login? From this point I would suggest using a /root/.withings-sync/{user}/… approach
Given tree users A B C
They will have 3 different withings accounts and also 3 different garmin accounts
This topic was raised some time ago, see https://github.com/jaroslawhartman/withings-sync/pull/84/files
How about storing it as ex. /root/{username}.session ?
I need to take a look on how multiple users are handled for withings and come up with a nice solution.