File tree 5 files changed +55
-2
lines changed
5 files changed +55
-2
lines changed Original file line number Diff line number Diff line change
1
+ #
2
+ # Copy and rename this file to .env at root of this project.
3
+ #
4
+
5
+ # A common use case is to supply database creds via the environment. Edit settings.php
6
+ # like so:
7
+ #
8
+ # $databases['default']['default'] = [
9
+ # 'database' => getenv('MYSQL_DATABASE'),
10
+ # 'driver' => 'mysql',
11
+ # 'host' => getenv('MYSQL_HOSTNAME'),
12
+ # 'namespace' => 'Drupal\\Core\\Database\\Driver\\mysql',
13
+ # 'password' => getenv('MYSQL_PASSWORD'),
14
+ # 'port' => getenv('MYSQL_PORT'),
15
+ # 'prefix' => '',
16
+ # 'username' => getenv('MYSQL_USER'),
17
+ # ];
18
+ #
19
+ # Uncomment and populate as needed.
20
+ # MYSQL_DATABASE=
21
+ # MYSQL_HOSTNAME=
22
+ # MYSQL_PASSWORD=
23
+ # MYSQL_PORT=
24
+ # MYSQL_USER=
25
+
26
+ # Another common use case is to set Drush's --uri via environment.
27
+ # DRUSH_OPTIONS_URI=http://example.com
Original file line number Diff line number Diff line change 19
19
20
20
# Ignore files generated by PhpStorm
21
21
/.idea /
22
+
23
+ # Ignore .env files as they are personal
24
+ /.env
Original file line number Diff line number Diff line change 2
2
3
3
[ ![ Build Status] ( https://travis-ci.org/drupal-composer/drupal-project.svg?branch=8.x )] ( https://travis-ci.org/drupal-composer/drupal-project )
4
4
5
- This project template should provide a kickstart for managing your site
5
+ This project template provides a starter kit for managing your site
6
6
dependencies with [ Composer] ( https://getcomposer.org/ ) .
7
7
8
8
If you want to know how to use it as replacement for
@@ -49,6 +49,7 @@ When installing the given `composer.json` some tasks are taken care of:
49
49
* Creates ` web/sites/default/files ` -directory.
50
50
* Latest version of drush is installed locally for use at ` vendor/bin/drush ` .
51
51
* Latest version of DrupalConsole is installed locally for use at ` vendor/bin/drupal ` .
52
+ * Creates environment variables based on your .env file. See [ .env.example] ( .env.example ) .
52
53
53
54
## Updating Drupal Core
54
55
Original file line number Diff line number Diff line change 22
22
"drupal/console" : " ^1.0.2" ,
23
23
"drupal/core" : " ~8.5" ,
24
24
"drush/drush" : " ^9.0.0" ,
25
+ "vlucas/phpdotenv" : " ^2.4" ,
25
26
"webflo/drupal-finder" : " ^1.0.0" ,
26
27
"webmozart/path-util" : " ^2.3"
27
28
},
39
40
"autoload" : {
40
41
"classmap" : [
41
42
" scripts/composer/ScriptHandler.php"
42
- ]
43
+ ],
44
+ "files" : [" load.environment.php" ]
43
45
},
44
46
"scripts" : {
45
47
"drupal-scaffold" : " DrupalComposer\\ DrupalScaffold\\ Plugin::scaffold" ,
Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ /**
4
+ * This file is included very early. See autoload.files in composer.json and
5
+ * https://getcomposer.org/doc/04-schema.md#files
6
+ */
7
+
8
+ use Dotenv \Dotenv ;
9
+ use Dotenv \Exception \InvalidPathException ;
10
+
11
+ /**
12
+ * Load any .env file. See /.env.example.
13
+ */
14
+ $ dotenv = new Dotenv (__DIR__ );
15
+ try {
16
+ $ dotenv ->load ();
17
+ }
18
+ catch (InvalidPathException $ e ) {
19
+ // Do nothing. Production environments rarely use .env files.
20
+ }
You can’t perform that action at this time.
0 commit comments