Environments allow you to run Tomahawk with different configuration, locally, on a dev box and on a production server.
For example locally you may have a filesytem driver used for caching, whereas on a development or production server you may have redis setup.
Tomahawk comes with 2 environments,
dev, each one having
its own front controller to send all requests through,
app.php for prod and
app_dev.php for dev.
Executing an Application in different environments
To execute an application in each environment, load up the application using either of the front controllers,
app.php for prod or
app_dev.php for dev, or any that you have setup:
- http:://yourdomain.com/app.php - prod environment
- http:://yourdomain.com/app_dev.php - dev environment
Selecting the Environment for Console Commands
By default, any commands ran in
hatchet, Tomahawks CLI are ran with the
dev environment with
debugging on. Use the
--no-debug options to modify this behavior:
In addition to the
--debug options, the behavior of Tomahawk commands can also be
controlled with environment variables. The Tomahawk console application (hatchet) checks the existence
and value of these environment variables before executing any command:
Sets the execution environment of the command to the value of this variable (
0, debug mode is disabled. Otherwise, debug mode is enabled.
Creating New Environments
Creating a new environment is easy:
1) In your
app/config directory create a directory for the name of
your environment, e.g
2) Then copy from the main
app/config and config files you want to change for that environment.
See the configuration section for more details on setting these.
3) You'll want this environment to be accessible via a browser, so you should also create a front controller
for it. Copy the
web/app.php file to
web/app_local.php and edit the environment to be local:
5) Boom! Your all good to go.