alfred-nutile-inc / env-deployer

Makes deploying Env super easy
13 stars 1 forks source link

Get file from target and merge into local #2

Open alnutile opened 9 years ago

alnutile commented 9 years ago

User should be able to type

php artisan envdeployer:get dev

And get the values from dev and merge them into their local. For example

APP_ENV=local

would become

#@dev
APP_ENV=local

If dev has a value local does not have that would be pulled in

#@dev
FOO_BAR=foo

Add #@dev helps us to later preserve this if stage has it as well etc.

baopham commented 9 years ago

Just want to make sure I understand all the edge cases correctly. They could affect how other command (envdeployer:push {target}) works

Case 1: Suppose my local .env is:

#@dev=foo_bar_dev
#@stage=foo_bar_stage
FOO_BAR=foo_bar_local

dev .env is:

FOO_BAR=foo_bar_dev

After running the command envdeployer:get dev, my new local .env will be:

#@dev=foo_bar_dev
#@stage=foo_bar_stage
#@dev                              <--------- now we have another tag @dev 
FOO_BAR=foo_bar_dev

Case 2: Suppose my local .env is:

FOO_BAR=foo_bar_local

dev .env is:

FOO_BAR=foo_bar_dev

stage .env is:

FOO_BAR=foo_bar_stage

After running 2 commands one after the other:

php artisan envdeployer:get dev
php artisan envdeployer:get stage

New local .env will be:

#@dev        <---- should we keep the previous tag that comes from the previous command?
#@stage
FOO_BAR=foo_bar_stage
alnutile commented 9 years ago

Case 1

would end up as

#@dev=foo_bar_dev <-- you already have the tag
#@stage=foo_bar_stage
FOO_BAR=foo_bar_dev

If you did not have the tag it would be added

Case 2

This would be

#@dev=foo_bar_dev
#@stage=foo_bar_stage
FOO_BAR=foo_bar_local <-- this is your local

Either of these when pushed to stage or dev on those systems the .env would look like

FOO_BAR=foo_bar_stage <-- this is stage

we remove all the #@

let me know if you want to slack later