Skip to content

[HttpKernel] Add parameters kernel.runtime_mode and kernel.runtime_mode.*, all set from env var APP_RUNTIME_MODE #19067

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

Merged
merged 1 commit into from
Oct 24, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 51 additions & 0 deletions reference/configuration/kernel.rst
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,56 @@ the configuration options used to run the application. This allows for example
to run an application with the ``prod`` config (``kernel.environment``) in different
scenarios like ``staging`` or ``production`` (``kernel.runtime_environment``).

``kernel.runtime_mode``
-----------------------

**type**: ``string`` **default**: ``%env(query_string:default:container.runtime_mode:APP_RUNTIME_MODE)%``

This parameter stores a query string of the current runtime mode used by the
application. For example, the query string looks like ``web=1&worker=0`` when
the application is running in web mode and ``web=1&worker=1`` when running in
a long-running web server. This parameter can be set by using the
``APP_RUNTIME_MODE`` env var.

.. versionadded:: 6.4

The ``kernel.runtime_mode`` parameter was introduced in Symfony 6.4.

``kernel.runtime_mode.web``
---------------------------

**type**: ``boolean`` **default**: ``%env(bool:default::key:web:default:kernel.runtime_mode:)%``
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
**type**: ``boolean`` **default**: ``%env(bool:default::key:web:default:kernel.runtime_mode:)%``
**type**: ``boolean`` **default**: ``%env(bool:default::key:web:default:kernel.runtime_mode??)%``

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this correct?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


Whether the application is running in a web environment.

.. versionadded:: 6.4

The ``kernel.runtime_mode.web`` parameter was introduced in Symfony 6.4.

``kernel.runtime_mode.cli``
---------------------------

**type**: ``boolean`` **default**: ``%env(not:default:kernel.runtime_mode.web:)%``

Whether the application is running in a CLI environment. By default,
this value is the opposite of the ``kernel.runtime_mode.web`` parameter.

.. versionadded:: 6.4

The ``kernel.runtime_mode.cli`` parameter was introduced in Symfony 6.4.

``kernel.runtime_mode.worker``
------------------------------

**type**: ``boolean`` **default**: ``%env(bool:default::key:worker:default:kernel.runtime_mode:)%``

Whether the application is running in a worker/long-running environment. Not all web
servers support it, and you have to use a long-running web server like `FrankenPHP`_.

.. versionadded:: 6.4

The ``kernel.runtime_mode.worker`` parameter was introduced in Symfony 6.4.

``kernel.secret``
-----------------

Expand Down Expand Up @@ -336,3 +386,4 @@ This parameter stores the value of

.. _`character encoding`: https://en.wikipedia.org/wiki/Character_encoding
.. _`reproducible builds`: https://en.wikipedia.org/wiki/Reproducible_builds
.. _`FrankenPHP`: https://frankenphp.dev