File tree Expand file tree Collapse file tree 1 file changed +38
-0
lines changed Expand file tree Collapse file tree 1 file changed +38
-0
lines changed Original file line number Diff line number Diff line change 1+ description : ' Add support and required config to work with an .env file'
2+ messages :
3+ template-env : |
4+ This file is a "template" of which env vars need to be defined
5+ for your application, use only on development stages.
6+ Create real environment variables when deploying to production.
7+ load-from-env : |
8+ If not using real environment variables.
9+ Make sure you add the dependency using composer
10+
11+ Drupal 8.5 and up versions `composer require symfony/dotenv`
12+ if (file_exists(dirname(DRUPAL_ROOT) . '/.env')) {
13+ $dotenv = new \Symfony\Component\Dotenv\Dotenv(dirname(DRUPAL_ROOT));
14+ $dotenv->load();
15+ }
16+
17+ Drupal 8.4 and minor versions `composer require vlucas/phpdotenv`
18+ if (file_exists(dirname(DRUPAL_ROOT) . '/.env')) {
19+ $dotenv = new \Dotenv\Dotenv(dirname(DRUPAL_ROOT));
20+ $dotenv->load();
21+ }
22+ load-settings : |
23+ # Load key/value settings
24+ $settings_drupal = array_filter(
25+ $_SERVER,
26+ function($key) {
27+ return strpos($key, 'SETTINGS_') === 0;
28+ },
29+ ARRAY_FILTER_USE_KEY
30+ );
31+
32+ # Set key/value settings
33+ foreach ($settings_drupal as $name => $value) {
34+ if (substr($name, 0, 9) === 'SETTINGS_') {
35+ $key = strtolower(substr($name, 9));
36+ $settings['settings'][$key] = $value;
37+ }
38+ }
You can’t perform that action at this time.
0 commit comments