-
-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Documented the console environment variables #4665
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 3 commits
7c4cd17
6fc8f4c
8ead4a4
a1d88d8
2fb082d
dd8157f
df2a0f2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -212,6 +212,37 @@ environment by using this code and changing the environment string. | |
mode. You'll need to enable that in your front controller by calling | ||
:method:`Symfony\\Component\\Debug\\Debug::enable`. | ||
|
||
Selecting the Environment for Console Commands | ||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
|
||
By default, Symfony commands are executed in the ``dev`` environment and with the | ||
debug mode enabled. Use ``--env`` and ``-no-debug`` options to modify this behavior: | ||
|
||
.. code-block:: bash | ||
|
||
# 'dev' environment and debug enabled | ||
$ php app/console command_name | ||
|
||
# 'prod' environment (debug is always disabled for 'prod') | ||
$ php app/console command_name --env=prod | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is wrong. The console file has a special handling for the prod env, forcing it to be in no-debug mode: https://github.com/symfony/symfony-standard/blob/20516f547e3282a1b3aeec2a284efd311aa9f5a4/app/console#L19 |
||
|
||
# 'test' environment and debug disabled | ||
$ php app/console command_name --env=test --no-debug | ||
|
||
In addition to ``--env`` and ``--debug`` options, Symfony commands behavior can | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [...] to the [...] There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It has to be "[...] Symfony commands' behavior [...] which reads really ugly. So I suggest to change this to "[...] the behavior of Symfony commands can [...]" |
||
also be controlled with environment variables. The Symfony console application | ||
checks the existence and value of these environment variables before executing | ||
any command: | ||
|
||
* ``SYMFONY_ENV``, sets the execution environment of the command to the value of | ||
this variable (``dev``, ``prod``, ``test``, etc.); | ||
* ``SYMFONY_DEBUG``, if ``0``, debug mode is disabled. Otherwise, debug mode is | ||
enabled. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What about using a definition list here? |
||
|
||
These environment variables are very useful for production servers, because they | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Afaik you can omit the comma. |
||
allow you to ensure that commands are always run on ``prod`` environment without | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [...] run in the [...] |
||
having to add any command option. | ||
|
||
.. index:: | ||
single: Environments; Creating a new environment | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use the [...]