How to plug module in controller only in production env?
Example:
plug BasicAuth, realm: "Admin Area", username: "admin", password: "pass"
While @whatyouhide's answer is correct, be careful using Mix.env in your project outside of mix tasks. If you decide to use Exrm or relx to build OTP releases, the mix library will not be included and this will crash your app on startup.
As an alternative, you can add an :env key to each environment's respective config file with the env value in it and then use it much like you would Mix.env.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With