@@ -589,25 +589,21 @@ different scenarios: staging, quality assurance, client review, etc.)
589
589
Configuration Based on Environment Variables
590
590
--------------------------------------------
591
591
592
- Using `environment variables `_ (or "env vars" for short) is a common practice to
593
- configure options that depend on where the application is run (e.g. the database
594
- credentials are usually different in production versus your local machine). If
595
- the values are sensitive, you can even :doc: `encrypt them as secrets </configuration/secrets >`.
592
+ Using `environment variables `_ (or "env vars" for short) is a common practice to:
593
+
594
+ * Configure options that depend on where the application is run (e.g. the database
595
+ credentials are usually different in production versus your local machine);
596
+ * Configure options that can change dynamically in a production environment (e.g.
597
+ to update the value of an expired API key without having to redeploy the entire
598
+ application).
599
+
600
+ In other cases, it's recommended to keep using :ref: `configuration parameters <configuration-parameters >`.
596
601
597
602
Use the special syntax ``%env(ENV_VAR_NAME)% `` to reference environment variables.
598
603
The values of these options are resolved at runtime (only once per request, to
599
604
not impact performance) so you can change the application behavior without having
600
605
to clear the cache.
601
606
602
- .. note ::
603
-
604
- Environment variables are designed to store information that can
605
- dynamically change in a production environment, such as an API
606
- key that may have an expiration date. This information could be updated
607
- without having to redeploy the application. Thus, not everything is a good
608
- candidate for env vars, and
609
- :ref: `parameters <configuration-parameters >` should be used in other cases.
610
-
611
607
This example shows how you could configure the application secret using an env var:
612
608
613
609
.. configuration-block ::
0 commit comments