4 ms·
@production looks risky, compared to checking an environment variable. Hopefully that host_name function is guaranteed to return the same result every time it
by kwertyoowiyop 4y ago
@production looks risky, compared to checking an environment variable. Hopefully that host_name function is guaranteed to return the same result every time it is called, and can never fail or raise an exception.
- rmbyrro 4y agoIt's also a bad idea, because it implies you have different implementations for each environment. Which means your dev and production environments are quite different, increasing risks of letting stupid mistakes slip into prod.
- kwertyoowiyop 4y agoOh so true. No matter how you express it, “if production” will likely land you in debugging hell sooner or later.
- giantrobot 4y agoYou can do the @production one with an envar or any other mechanism. I've been using it for years (with an envar) and it works really well. Besides switching between something like production and test you can catch a case where an envar isn't set or is an unexpected value.