11# Environment-Based Drupal Settings
22This package extends Symfony's [ symfony/dotenv] ( https://symfony.com/components/Dotenv )
3- component to allow streamlined Drupal config via ` .env ` files. Please refer to the
4- component's documentation about how ` .env ` files are used.
3+ component to allow streamlined Drupal config via [ Environment Variables] ( https://en.wikipedia.org/wiki/Environment_variable ) .
4+ Please refer to the Symfony component's documentation about how ` .env ` files
5+ should be used. It is important to note that ` .env ` files are _ ignored_ if the
6+ ` APP_ENV ` var has already been set by the server. For performance purposes,
7+ production environments should ideally rely on pre-configured environment variables,
8+ rather than environment variable values loaded from ` .env ` files.
59
610## Installation
711
@@ -69,7 +73,11 @@ $dotenv = new Dotenv();
6973$sites = $dotenv->getSites();
7074```
7175
72- #### Configuring Drupal via ENV Variables
76+ #### Installation Conclusion
77+ That's it! Drupal will now attempt to load essential connection information from
78+ Environment Variables.
79+
80+ ### Configuring Drupal via ENV Variables
7381This package will provide many default setting & configuration values based on the
7482detected environment. Some of these values can be populated by environment variables.
7583
@@ -83,7 +91,7 @@ configuration.
8391* [ SOLR_URL] ( #solr_url )
8492* More configuration options coming soon!
8593
86- ##### DATABASE_URL
94+ #### DATABASE_URL
8795The default database connection can be configured via a [ DSN] ( https://en.wikipedia.org/wiki/Data_source_name ) :
8896
8997``` dotenv
@@ -96,27 +104,27 @@ For example:
96104DATABASE_URL=mysql://foo:bar@host:3306/baz
97105```
98106
99- For multi-site installations, do _ not_ specify a database name in the ENV file(s) :
107+ For multi-site installations, do _ not_ specify a database name in the ` DATABASE_URL ` variable :
100108
101109``` dotenv
102110DATABASE_URL=mysql://foo:bar@host:3306
103111```
104112
105- ##### DOMAINS
113+ #### DOMAINS
106114A CSV list of domains used by the given environment:
107115
108116``` dotenv
109117DOMAINS=foo.example,bar.example,baz.example
110118```
111119
112- ##### SITES
120+ #### SITES
113121A CSV list of Drupal "sites" (e.g. "subdomains") used by the given environment:
114122
115123``` dotenv
116124SITES=foo,bar,baz,qux
117125```
118126
119- ##### SOLR_URL
127+ #### SOLR_URL
120128The default Solr connection can be configured via a [ DSN] ( https://en.wikipedia.org/wiki/Data_source_name ) :
121129
122130``` dotenv
@@ -136,8 +144,8 @@ so the shorter DSN can be used.
136144
137145Streamlined environment-dependent configuration of _ one_ Solr core is supported at this time.
138146
139- ##### Supported Placeholders
140- * ` {{app_path}} ` : The path where Drupal is located.
141- * ` {{project_path}} ` : The path where the project is located.
142- * ` {{site_name}} ` : The name of the Drupal site. Defaults to ` default ` .
143- * ` {{virtual_host}} ` : The value of ` $_SERVER['VIRTUAL_HOST'] ` .
147+ #### Configuration Conclusion
148+ With these few Environment Variables, you will be able to configure Drupal in a streamlined
149+ fashion similar to the way Symfony is configured. Support for integration of many more common
150+ integrations can be expected soon. Please consider creating a Pull Request with integration(s)
151+ you would like to see added .
0 commit comments