3 ms·
Yeah and it results in so many small, seemingly insiginificant things that can bite you. Like the last point in which I guess the author had hardcoded their red
by jamil7 7y ago
Yeah and it results in so many small, seemingly insiginificant things that can bite you. Like the last point in which I guess the author had hardcoded their redis uri rather than using the environment variable provided by Heroku. How would anyone know about that unless they had been told by someone or been bitten in the past or had some understanding of how Heroku worked underneath.
Edit: from the comments it's clear that OP didn't actually hardcode the connection string.
- korijn 7y agoTo be fair, haven't we all (eventually) learned to support environment configuration by messing it up in similar ways at some point?
- jamil7 7y agoAbsolutely! maybe it's one of those things you just have to mess up to understand why it's important.
- golergka 7y agoCan't really agree with that. Although most of my experience and expertise is with mobile game development, I think that I've read at least 5 blog posts and articles that explained that all connection strings, usernames and passwords (aside from something really trivial for local testing) should always be read from environment variables and never be hardcoded, and arguments were convincing enough. So, even if I haven't worked with Heroku before, I would look for a way to get this url in a service-provided environment variable. Also, I would look to configure all components to fail loudly, so that if something wouldn't connect to Redid, my server just wouldn't launch. I'm not trying to say that I'm better or smarter than OP: I've actually tried learning bioinformatics, but dropped out of uni 14 years ago, realising that my brain is just not created for anything biology-related. Rather my point is, many of these problems (and problems I've seen junior developers struggling with) are not some arcane knowledge that you should just learn by heart (like all of those awful genus names in Latin, or all the enzymes in the dreadful ATP scheme that I still have nightmares of sometimes), but a logical extension of more basic and universal principles that actually make total sense once you think about them.
- jamil7 7y agoSure but it's something thats easily overlooked or neglected, many tutorials might tell a beginner to do it but not _why_ to do it which is important. It's also easy to hardcode during testing or development and forget about. Why would someone without a software background expect that a url could change from under them? > Also, I would look to configure all components to fail loudly, so that if something wouldn't connect to Redid, my server just wouldn't launch. In this case though the OP did not have control over the redis connection handling it was through a dependency that silently timed out.
- LifeIsBio 7y agoTwo quick points here: 1. A few years ago, I probably would have made the mistake of actually hard-coding my connection strings, usernames and passwords. I'm pretty sure I did that on my first ever webapp, cause I didn't know any better. So, not defending my intelligence, or taking any offense at your statement. 2. But... That's not what's happened here. I'm setting the redis url inside Heroku's "Config Vars" section, and then reading it in with Django's `env()` functionality, as is appropriate. But the url has seemingly been changed from underneath me, for a reason I still don't fully understand. Side-note: I used to be under the impression that CS was "harder" than biology, and that anyone who understood CS could pick up biology at will, if they decided. Turns out that's not the case, haha.
- jamil7 7y agoAppologies for my earlier comment then I misunderstood your last point. I think my point still stands though. Thanks for the article!
- spacehunt 7y ago> But the url has seemingly been changed from underneath me, for a reason I still don't fully understand. Is the Redis add-on attached to the Heroku instance? This is how Heroku knows which instances' environment variables need updating when rotating credentials.