Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dotenv #21

Merged
merged 8 commits into from Jan 12, 2017
Merged

Dotenv #21

merged 8 commits into from Jan 12, 2017

Conversation

tomdavies
Copy link
Contributor

As previously discussed in #20

* from it
*/

// 'dotenv_path' => __DIR__,
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I prefer the __DIR__ default. Can you restore this? I think it'd be better to have the default, and then do a file_exists before loading Dotenv.

@@ -292,6 +293,11 @@ protected function loadConfig()
define('CRAFT_TRANSLATIONS_PATH', rtrim($config['craft_translations_path'], '/').'/');
}

if (isset($config['dotenv_path'])) {
Copy link
Owner

@rsanchez rsanchez Jan 11, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd like to see a default dotenv_path set here in case the user does not have a .craft-cli.php config file.

$dotenvPath = isset($config['dotenv_path']) ? $config['dotenv_path'] : getcwd();

This is also where you should add the file exists check so we can have a default dotenv_path:

if (file_exists($dotenvPath.'/.env')) {
    $dotenv = new Dotenv($dotenvPath);
    $dotenv->load();
}

@@ -292,6 +293,11 @@ protected function loadConfig()
define('CRAFT_TRANSLATIONS_PATH', rtrim($config['craft_translations_path'], '/').'/');
}

if (isset($config['dotenv_path'])) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, can you move the Dotenv loading above this line, before the $environment variable is set: https://github.com/tomdavies/craft-cli/blob/4ad9653e4b0b8b6deb5c1ebdd2cad2fa01c7720e/src/Application.php#L270

@rsanchez
Copy link
Owner

rsanchez commented Jan 11, 2017

I left a few comments regarding some changes I'd like to see before merging. I'd be happy to make the changes myself if you give me write access to your Pull Request (see this guide: https://help.github.com/articles/allowing-changes-to-a-pull-request-branch-created-from-a-fork/).

The purpose of these changes is so that someone can add a .env file with zero-config.

@tomdavies
Copy link
Contributor Author

tomdavies commented Jan 11, 2017 via email

* master:
  add documentation for dotenv usage
  amends from @rsanchez's code review
  Add phpdotenv support
@tomdavies
Copy link
Contributor Author

@rsanchez amends per your eminently sensible comments. You have write access to my PR branch if you want to do anything further - feel free.

@rsanchez rsanchez merged commit 226d86f into rsanchez:master Jan 12, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants