If you apply .env
modules to your service, .env
files need to be handled.
As you divide your service into micro services, .env
files are getting more like tribbles.
I hope you can manage your envs easily without any mistakes with this cli.
$ npm install -g env-switcher
Move into your project directory.
- Initialize env-switcher for your project.
$ envswitch init <env_name>
- you can run without env_name parameter, then your default name of env setting is: 'default'
$ envswitch init
- Then
.envswitcher
will be automatically added to.gitignore
if it exists.
- For ElasticBeanstalk users: it should be added to
.ebignore
manually.
- Put env files into
.envswitcher
. example:
.envswitcher
|-dev
|-prod
|-...
You can choose any names as your own envs
.
$ envswitch use <env_name>
For example, you wanna change your .env files as development environment.
(When you made your own env files dev
in .envswitcher
.)
$ envswitch use dev
Put the command below to swtich environment as production.
$ envswitch use prod
And you wanna change environment to mytest
$ envswitch use mytest
$ envswitch list
$ envswitch update <env_name>
$ envswitch status
$ envswitch --help
- add a command
update <env_name>