Magento, DI and env vars
Some time ago, I was integrating an external library into Magento 2. The library required API credentials to be passed into its constructor, so I thought environment variables (env vars) would be a perfect fit. Magento’s Dependency Injection (DI) system supports this—or so I thought. Well, it does in theory… or rather, I’ve used this method before.