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

Account for possibly changing DATABASE_URL env var #19

Open
xbony2 opened this issue Jun 7, 2022 · 1 comment
Open

Account for possibly changing DATABASE_URL env var #19

xbony2 opened this issue Jun 7, 2022 · 1 comment
Assignees
Labels
bug Something isn't working invalid This doesn't seem right

Comments

@xbony2
Copy link
Owner

xbony2 commented Jun 7, 2022

I'm not sure, but I have a strong suspicion that a !fix_double_redirects command I tried failed because of Heroku's (not entirely undeserved) security obsession:

Heroku rotates credentials periodically and updates applications where this database is attached.

When deployed, the env var DATABASE_URL specifies where ESAEBSAD3 connects to. Currently, we only do the connection once, when everything is initialized. If this env var changes (which I suspect is the case here), then this means ESAEBSAD would fail to connect to the DB, since it would be relying on the outdated url. I'm not completely sure though, and will need to test this.

Solution is pretty easy but requires some refactoring: use a method to get an instance of the DB each time instead of accessing it directly, and have it check if the env var changed. This will result in a lot of redundant changes of course, but performance-wise checking local env vars is peanuts compared to querying a database.

@xbony2 xbony2 added the bug Something isn't working label Jun 7, 2022
@xbony2 xbony2 self-assigned this Jun 7, 2022
@xbony2
Copy link
Owner Author

xbony2 commented Jun 7, 2022

This doesn't seem to be the problem but it could be a potential issue, so will leave it up. Probably Heroku just restarts the dyno though.

@xbony2 xbony2 added the invalid This doesn't seem right label Jun 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working invalid This doesn't seem right
Projects
None yet
Development

No branches or pull requests

1 participant