Skip to content

Commit

Permalink
Integrated .env package
Browse files Browse the repository at this point in the history
Using .env allows passwords with special characters to be used. Added
timezone to .env to get rid of timezone warning.
  • Loading branch information
mark1282 committed Aug 17, 2016
1 parent 1b84abe commit 76103f7
Show file tree
Hide file tree
Showing 5 changed files with 108 additions and 34 deletions.
6 changes: 6 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
EMAIL=test.com
PASSWORD=password
LOCAL_PATH=Downloads
LESSONS_FOLDER=lessons
SERIES_FOLDER=series
TIMEZONE=Europe/London
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,7 @@ config.ini~
.gitignore~
vendor
cacert.pem

.env

*.mp4
23 changes: 18 additions & 5 deletions bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,29 @@
/*
* Options
*/
$options = parse_ini_file('config.ini');

/*
* Constants
*/
//local
$options = array();

$dotenv = new Dotenv\Dotenv(__DIR__);
$dotenv->load();

$timezone = getenv('TIMEZONE');

date_default_timezone_set($timezone);

//Login
$options['password'] = getenv('PASSWORD');
$options['email'] = getenv('EMAIL');
//Paths
$options['local_path'] = getenv('LOCAL_PATH');
$options['lessons_folder'] = getenv('LESSONS_FOLDER');
$options['series_folder'] = getenv('SERIES_FOLDER');

define('BASE_FOLDER', $options['local_path']);
define('LESSONS_FOLDER', $options['lessons_folder']);
define('SERIES_FOLDER', $options['series_folder']);


//laracasts
define('LARACASTS_BASE_URL', 'https://laracasts.com');
define('LARACASTS_ALL_PATH', 'lessons');
Expand Down
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
"symfony/dom-crawler": "~2.6",
"symfony/css-selector": "~3.0@dev",
"devster/ubench": "~1.1@dev",
"ext-curl": "*"
"ext-curl": "*",
"vlucas/phpdotenv": "^2.3"
},
"require-dev": {
"digitalnature/php-ref": "dev-master"
Expand Down
106 changes: 78 additions & 28 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 76103f7

Please sign in to comment.