Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Env varible default bool bug and feature to accrue time by device rather than user #28

Closed
ShanaryS opened this issue Aug 22, 2023 · 2 comments

Comments

@ShanaryS
Copy link
Contributor

ShanaryS commented Aug 22, 2023

os.getenv(A, B) looks for env variable A and returns B as a default if it doesn't exist. However variable B is always returned as a string, regardless of what the function was called with.

For DELETE_DEVICE_IF_NO_MEDIA_CONTROLS, B is set to the bool False, which gets converted to the string "False". This will always True for bool("False") since the string is not empty. This is a very annoying oversight from the python developers. A better check is:

DELETE_DEVICE_IF_NO_MEDIA_CONTROLS = os.getenv("DELETE_DEVICE_IF_NO_MEDIA_CONTROLS", "True").lower() == "true"

I've created a PR that includes this change. This PR also includes a new env variable that allows time to be accrued by DeviceId rather than UserId. So the same user with multiple devices is treated differently.

PR: #27

@WardPearce
Copy link
Owner

Will be deployed whenever #29 merges.

Haven't been active in this repo for a while, so appears some things will need to change

@WardPearce
Copy link
Owner

Thanks for the PR, merged into production now. Docker image should be up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants