Closed grplyler closed 4 years ago
Would be cool, if there's one more test :yum:
NODE_ENV=development
.env
file exists.env.development
does not exist.env
are loaded correctly and no error is thrownI can do that this afternoon! Was actually just reading about japa. Lol another good library from Mr. Virk. Will probably use it in my other projects too.
Can you please help the use case in which you need multiple .env
files for different environments?
I usually work in 3 environments ie. development
, staging
and production
.
.env
file, that is in my source code locally and never committed to Github..env
file pre-created on the the staging server..env
file, pre-created on the server..env
files, hence I can login to the UI and create environment variables there (for example: Heroku)I am curious to know the use-case in which you need a separate file for each environment
Closing since no response from the issue reporter and not actionable as well
Proposed changes
Following up with my forum post, https://forum.adonisjs.com/t/more-env-files-other-than-env-testing/6562 it seems that adonisjs only supports one alternative .env file called
.env.testing
. It would seem to me like an easy addition to add support for more.env
files based onNODE_ENV
environment variable. (I needed 3 for my Adonis and Nuxtjs project)Types of changes
I have made a small change (less than 5 LOC not including tests) which loads an alternate
.env
based onNODE_ENV
. For example, ifNODE_ENV=development
, then a.env.development
will be loaded and merged. IfNODE_ENV=foobar
then a.env.foobar
will be loaded if it exists, etc. Of course,.env.testing
still works as well.I have also written 3 tests (an additional 6-9ms of testing time) that test my added functionality.
What types of changes does your code introduce?
Checklist
Note: If accepted, I will be happy to add the relevant documentation.
Further comments
While I have 4+ years in Javascript development and 5+ in Python, this is my first formal pull request, and I will not be offended if I need to change anything to improve my addition or if it goes against any principles and gets rejected.
I love Adonisjs and I hope to see it continue to prosper!
Thanks! Ryan