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

Allow easier customization of the .env file #7380

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
File renamed without changes.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# gitignore file for WordPress Core

# Configuration files with possibly sensitive information
.env
wp-config.php
wp-tests-config.php
.htaccess
Expand Down
14 changes: 14 additions & 0 deletions tools/local-env/scripts/start.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,20 @@ const dotenv = require( 'dotenv' );
const dotenvExpand = require( 'dotenv-expand' );
const { execSync } = require( 'child_process' );

try {
execSync( 'test -f .env', { stdio: 'inherit' } );
} catch ( e ) {
// test exits with a status code of 1 if the test fails.
// Alert the user on any other failure.
if ( e.status !== 1 ) {
throw e;
}

// The file does not exist, copy over the default example file.
execSync( 'cp .env.example .env', { stdio: 'inherit' } );
}


dotenvExpand.expand( dotenv.config() );

// Check if the Docker service is running.
Expand Down
Loading