Skip to content

Commit

Permalink
Merge pull request #15 from moderntribe/fix/lookup-more-env-paths
Browse files Browse the repository at this point in the history
fix(src/scaffold.php) look up more env paths
  • Loading branch information
lucatume authored Jun 24, 2020
2 parents ff382a4 + 917c739 commit 12c2717
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions src/scaffold.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,18 @@ function write_tric_env_file( $plugin_path ) {
$mysql_root_password = getenv( 'MYSQL_ROOT_PASSWORD' );
$wp_http_port = getenv( 'WORDPRESS_HTTP_PORT');

if ( file_exists( $plugin_path . '/.env.testing' ) ) {
$plugin_env = file_get_contents( $plugin_path . '/.env.testing' );
} else {
$plugin_env = file_get_contents( $plugin_path . '/.env' );
$plugin_env = null;
$candidate_env_files = [
'.env.testing',
'.env',
'.env.dist'
];
foreach ( $candidate_env_files as $candidate ) {
if ( ! file_exists( $candidate ) ) {
continue;
}
$plugin_env = file_get_contents( $plugin_path . '/' . $candidate );
break;
}

$wp_domain = 'wordpress.test';
Expand Down

0 comments on commit 12c2717

Please sign in to comment.