diff --git a/README.md b/README.md index 0a83e5b..b1240cc 100644 --- a/README.md +++ b/README.md @@ -143,7 +143,7 @@ DEV_MODE=true getenv('DEV_MODE'), + 'devMode' => env('DEV_MODE'), ); ``` diff --git a/composer.json b/composer.json index 308027a..f133d71 100644 --- a/composer.json +++ b/composer.json @@ -1,5 +1,6 @@ { "require": { - "vlucas/phpdotenv": "^2.2" + "vlucas/phpdotenv": "^2.2", + "oscarotero/env": "^1.0" } } diff --git a/composer.lock b/composer.lock index 9f35c64..0e01c48 100644 --- a/composer.lock +++ b/composer.lock @@ -4,33 +4,74 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "d5910eda0f0e403002a354ef91f0ba5f", - "content-hash": "38087ce5eefc89bbb67f4745aeac8c27", + "hash": "b15341b033355abbd910433861cb26a2", "packages": [ + { + "name": "oscarotero/env", + "version": "v1.0.2", + "source": { + "type": "git", + "url": "https://github.com/oscarotero/env.git", + "reference": "0819fd764ca19ab880b8d9ed7a95ae4910f98f20" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/oscarotero/env/zipball/0819fd764ca19ab880b8d9ed7a95ae4910f98f20", + "reference": "0819fd764ca19ab880b8d9ed7a95ae4910f98f20", + "shasum": "" + }, + "require": { + "php": ">=5.2" + }, + "type": "library", + "autoload": { + "psr-0": { + "Env": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Oscar Otero", + "email": "oom@oscarotero.com", + "homepage": "http://oscarotero.com", + "role": "Developer" + } + ], + "description": "Simple library to consume environment variables", + "homepage": "https://github.com/oscarotero/env", + "keywords": [ + "env" + ], + "time": "2016-05-08 17:14:32" + }, { "name": "vlucas/phpdotenv", - "version": "v2.2.0", + "version": "v2.3.0", "source": { "type": "git", "url": "https://github.com/vlucas/phpdotenv.git", - "reference": "9caf304153dc2288e4970caec6f1f3b3bc205412" + "reference": "9ca5644c536654e9509b9d257f53c58630eb2a6a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/vlucas/phpdotenv/zipball/9caf304153dc2288e4970caec6f1f3b3bc205412", - "reference": "9caf304153dc2288e4970caec6f1f3b3bc205412", + "url": "https://api.github.com/repos/vlucas/phpdotenv/zipball/9ca5644c536654e9509b9d257f53c58630eb2a6a", + "reference": "9ca5644c536654e9509b9d257f53c58630eb2a6a", "shasum": "" }, "require": { "php": ">=5.3.9" }, "require-dev": { - "phpunit/phpunit": "^4.8|^5.0" + "phpunit/phpunit": "^4.8 || ^5.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.2-dev" + "dev-master": "2.3-dev" } }, "autoload": { @@ -40,7 +81,7 @@ }, "notification-url": "https://packagist.org/downloads/", "license": [ - "BSD" + "BSD-3-Clause-Attribution" ], "authors": [ { @@ -50,13 +91,12 @@ } ], "description": "Loads environment variables from `.env` to `getenv()`, `$_ENV` and `$_SERVER` automagically.", - "homepage": "http://github.com/vlucas/phpdotenv", "keywords": [ "dotenv", "env", "environment" ], - "time": "2015-12-29 15:10:30" + "time": "2016-06-14 14:14:52" } ], "packages-dev": [], diff --git a/scripts/install.sh b/scripts/install.sh index a84f348..54c2245 100644 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -30,19 +30,19 @@ echo " getenv('DB_SERVER'), + 'server' => env('DB_SERVER'), // The name of the database to select. - 'database' => getenv('DB_DATABASE'), + 'database' => env('DB_DATABASE'), // The database username to connect with. - 'user' => getenv('DB_USER'), + 'user' => env('DB_USER'), // The database password to connect with. - 'password' => getenv('DB_PASSWORD'), + 'password' => env('DB_PASSWORD'), // The prefix to use when naming tables. This can be no more than 5 characters. - 'tablePrefix' => getenv('DB_TABLE_PREFIX'), + 'tablePrefix' => env('DB_TABLE_PREFIX'), ); " > craft/config/db.php @@ -67,16 +67,16 @@ echo " true, - 'allowAutoUpdates' => false, + 'allowAutoUpdates' => env('ALLOW_AUTO_UPDATES') ?? false, 'environmentVariables' => array( 'siteUrl' => SITE_URL, 'basePath' => BASEPATH ), - 'devMode' => getenv('DEV_MODE'), - 'enableTemplateCaching' => getenv('ENABLE_TEMPLATE_CACHING'), - 'testToEmailAddress' => getenv('TEST_TO_EMAIL_ADDRESS'), + 'devMode' => env('DEV_MODE') ?? false, + 'enableTemplateCaching' => env('ENABLE_TEMPLATE_CACHING') ?? true, + 'testToEmailAddress' => env('TEST_TO_EMAIL_ADDRESS'), ); " > craft/config/general.php @@ -84,8 +84,13 @@ echo "load(); +try { + (new Dotenv\Dotenv(__DIR__ . '/../'))->load(); +} catch (Dotenv\Exception\InvalidPathException \$e) { + // +} + +Env::init(); // Path to your craft/ folder \$craftPath = '../craft';