Skip to content

Instantly share code, notes, and snippets.

@sergiohidalgo
Last active May 8, 2017 22:03
Show Gist options
  • Save sergiohidalgo/b212c32980d4f090a9ab7970de411344 to your computer and use it in GitHub Desktop.
Save sergiohidalgo/b212c32980d4f090a9ab7970de411344 to your computer and use it in GitHub Desktop.
WP Config base para usar archivo .env
DB_NAME=""
DB_USER=""
DB_PASSWORD=""
DB_HOST=""
DB_CHARSET="utf8"
DB_COLLATE=""
TABLE_PREFIX="wp_"
WP_SITEURL=""
WP_HOME=""
WP_DEBUG=""
WPMS_MAILGUN=""
WPMS_MAIL_FROM=""
WPMS_MAIL_FROM_NAME=""
WPMS_SMTP_USER=""
WPMS_SMTP_PASS=""
### Miscellaneous
.DS_Store
Thumbs.db
*.log
*.zip
.htaccess
*.sql
### Composer
/vendor/
composer.lock
### IDE
.idea/
### Docker
/data/
### PHPCS
cs_fixer*
### Wordpress
/public/wp-content/uploads/
/public/wp-content/wflogs/
error_log
### Environment
.env
{
"name": "lafabricaimaginaria/projectname",
"require": {
"vlucas/phpdotenv": "^2.4"
}
}
<?php
/*----------------------------------------------------*/
// Composer
/*----------------------------------------------------*/
if (file_exists($autoload = __DIR__ . '/../vendor/autoload.php'))
require_once $autoload;
$dotenv = new Dotenv\Dotenv(__DIR__ . '/../');
$dotenv->load();
/*----------------------------------------------------*/
// WordPress database
/*----------------------------------------------------*/
define('DB_NAME', getenv('DB_NAME'));
define('DB_USER', getenv('DB_USER'));
define('DB_PASSWORD', getenv('DB_PASSWORD'));
define('DB_HOST', getenv('DB_HOST'));
define('DB_CHARSET', getenv('DB_CHARSET')); // [utf8mb4, utf8]
define('DB_COLLATE', getenv('DB_COLLATE')); // [utf8mb4_unicode_ci]
$table_prefix = getenv('TABLE_PREFIX');
/*----------------------------------------------------*/
// Authentication unique keys and salts:
// https://api.wordpress.org/secret-key/1.1/salt/
/*----------------------------------------------------*/
define('AUTH_KEY', '');
define('SECURE_AUTH_KEY', '');
define('LOGGED_IN_KEY', '');
define('NONCE_KEY', '');
define('AUTH_SALT', '');
define('SECURE_AUTH_SALT', '');
define('LOGGED_IN_SALT', '');
define('NONCE_SALT', '');
/*----------------------------------------------------*/
// Custom settings
/*----------------------------------------------------*/
define('WPLANG', 'es_ES');
define('WP_AUTO_UPDATE_CORE', false);
define('DISALLOW_FILE_EDIT', true);
define('WP_DEBUG_LOG', true);
if(getenv('WP_SITEURL'))
define('WP_SITEURL', getenv('WP_SITEURL'));
if(getenv('WP_HOME'))
define('WP_HOME', getenv('WP_HOME'));
/*----------------------------------------------------*/
// Debug
/*----------------------------------------------------*/
define('WP_DEBUG', getenv('WP_DEBUG') == 'true' ? true : false);
define('SAVEQUERIES', !WP_DEBUG);
define('WP_DEBUG_DISPLAY', WP_DEBUG);
define('SCRIPT_DEBUG', WP_DEBUG);
define('WP_DEBUG_LOG', WP_DEBUG);
if(WP_DEBUG){
ini_set('log_errors','On');
ini_set('display_errors','Off');
ini_set('error_reporting', E_ALL );
}
/*----------------------------------------------------*/
// WP SMTP
/*----------------------------------------------------*/
define('WPMS_MAILGUN', getenv('WPMS_MAILGUN') == 'true' ? true : false);
define('WPMS_ON', WPMS_MAILGUN);
define('WPMS_MAIL_FROM', getenv('WPMS_MAIL_FROM'));
define('WPMS_MAIL_FROM_NAME', getenv('WPMS_MAIL_FROM_NAME'));
define('WPMS_MAILER', 'smtp');
define('WPMS_SET_RETURN_PATH', 'false');
define('WPMS_SMTP_HOST', 'smtp.mailgun.org');
define('WPMS_SMTP_PORT', 587);
define('WPMS_SSL', 'tls');
define('WPMS_SMTP_AUTH', true);
define('WPMS_SMTP_USER', getenv('WPMS_SMTP_USER'));
define('WPMS_SMTP_PASS', getenv('WPMS_SMTP_PASS'));
if ( !defined('ABSPATH') )
define('ABSPATH', dirname(__FILE__) . '/');
require_once(ABSPATH . 'wp-settings.php');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment