3 ms·
Since there's no standard, presumably different people use different methods, or sometimes none at all. Beyond that, people could still make a mistake and put
by sbov 8y ago
Since there's no standard, presumably different people use different methods, or sometimes none at all. Beyond that, people could still make a mistake and put something in code that belongs in an env file.
- SwiftyBug 8y agoHonest question: where should I put that env file?
- peterwwillis 8y agoYou can keep a .env.default or .env.sample in your repo, but never use it directly. It should only document what the available parameters are. Using a .env file is a bit of an anti-pattern, partly because many applications expect it and thus will be affected by it in ways you might not want. But also because passing configuration to applications via environment is not great, because then the values ar all static and the only way to change them is to restart the app. Better to have a function that can reload a real data format (json, yaml, ini) at run-time. Each environment that runs your app will need to have its own 'env file' because every environment is slightly different, and they're coupled to deployments. So I'd keep your environment stuff wherever your deployment stuff is; with your terraform/ansible/puppet/chef configs, or etc/consul, or an S3 bucket, or SSM, etc. Create it at deploy time, pull it into the app at run time.