Hi devs!
Recently I've noticed there is abandoned #160 issue, however I think this is gonna be useful for many of Magallanes users.
- Environent variables can be set by passing options to general config...
# .mage/config/general.yml
name: My fantastic App
email: [email protected]
env:
variables:
node_path: "/bin/node"
symfony_env: prod
- ... or environment config...
# .mage/config/environment/production.yml
deployment:
user: root
from: ./
to: /var/www/vhosts/example.com/www
env:
variables:
symfony_env: prod
# .mage/config/environment/production.yml
tasks:
pre-deploy:
- scm/update
on-deploy:
- symfony2/cache-warmup: { env: prod, env: { variables: {env1: key1} } }
# short way
- symfony2/cache-warmup: { env: prod, env.variables: {env1: key1} }
When you run the command, the set variables are prepended to the original command:
$ SYMFONY_ENV=prod composer install
(Note: The script does not uppercases variables, they're gonna be passed in the same way you typed them in config)
Given variables have the following priorities:
- Task parameters and command line parameters
- Environment config parameters
- General config parameters
That means, if you have the env variable in your task configuration and there's an env var in your environment configuration, the task's one will override the environment's config.
The scripts allows also to prepend all system's environment variables, but it needs proper setting in your php.ini
for CLI:
# php.ini
variables_order="EGPCS"
Then, you can set your settings from .bashrc
or .zshrc
, like:
# .zshrc
export NODE_PATH="bin/node"
System's env variables has the lowest prority to give you ability to override them in config.
Warning: Including system's environment variables can slow down the applicattion, so use it carefully.
Feel free to review and comment! I know there's gonna be do much more, all sugestions are welcome!
Feedback Needed Improvement v1