Commit 72fb7e78 authored by Fabio Montefuscolo's avatar Fabio Montefuscolo

Uses the same environment variables of stock wordpress image

parent 6adcbfe1
......@@ -4,60 +4,54 @@ keygen() {
cat /dev/urandom | tr -dc '[:print:]' | tr "\\\\" "-" | tr "'" "-" | head -c64;
}
export AUTH_KEY="${AUTH_KEY:-$(keygen)}"
export SECURE_AUTH_KEY="${SECURE_AUTH_KEY:-$(keygen)}"
export LOGGED_IN_KEY="${LOGGED_IN_KEY:-$(keygen)}"
export NONCE_KEY="${NONCE_KEY:-$(keygen)}"
export AUTH_SALT="${AUTH_SALT:-$(keygen)}"
export SECURE_AUTH_SALT="${SECURE_AUTH_SALT:-$(keygen)}"
export LOGGED_IN_SALT="${LOGGED_IN_SALT:-$(keygen)}"
export NONCE_SALT="${NONCE_SALT:-$(keygen)}"
export AUTH_KEY="${WORDPRESS_AUTH_KEY:-$(keygen)}"
export AUTH_SALT="${WORDPRESS_AUTH_SALT:-$(keygen)}"
export LOGGED_IN_KEY="${WORDPRESS_LOGGED_IN_KEY:-$(keygen)}"
export LOGGED_IN_SALT="${WORDPRESS_LOGGED_IN_SALT:-$(keygen)}"
export NONCE_KEY="${WORDPRESS_NONCE_KEY:-$(keygen)}"
export NONCE_SALT="${WORDPRESS_NONCE_SALT:-$(keygen)}"
export SECURE_AUTH_KEY="${WORDPRESS_SECURE_AUTH_KEY:-$(keygen)}"
export SECURE_AUTH_SALT="${WORDPRESS_SECURE_AUTH_SALT:-$(keygen)}"
export WP_DEBUG="${WP_DEBUG:-$WORDPRESS_WP_DEBUG}"
export WP_DEBUG_LOG="${WP_DEBUG_LOG:-$WORDPRESS_WP_DEBUG_LOG}"
export WP_DEBUG_DISPLAY="${WP_DEBUG_DISPLAY:-$WORDPRESS_WP_DEBUG_DISPLAY}"
export WP_DEBUG="${WORDPRESS_DEBUG:-false}"
export WP_DEBUG_LOG="${WORDPRESS_DEBUG_LOG:-false}"
export WP_DEBUG_DISPLAY="${WORDPRESS_DEBUG_DISPLAY:-false}"
if [ "$WP_DEBUG" != "true" ];
if [ "$OPCACHE" = "true" ];
then
if [ "$OPCACHE" != "false" ];
then
inifile="/usr/local/etc/php/conf.d/opcache-recommended.ini" ;
{
echo 'opcache.memory_consumption=128';
echo 'opcache.interned_strings_buffer=8';
echo 'opcache.max_accelerated_files=4000';
echo 'opcache.revalidate_freq=60';
echo 'opcache.fast_shutdown=1';
echo 'opcache.enable_cli=1';
} > $inifile;
unset inifile;
fi
inifile="/usr/local/etc/php/conf.d/opcache-recommended.ini" ;
{
echo 'opcache.memory_consumption=128';
echo 'opcache.interned_strings_buffer=8';
echo 'opcache.max_accelerated_files=4000';
echo 'opcache.revalidate_freq=60';
echo 'opcache.fast_shutdown=1';
echo 'opcache.enable_cli=1';
} > $inifile;
unset inifile;
fi
if [ "$WP_DEBUG" = "true" ];
if [ "$WORDPRESS_DEBUG" = "true" ] && [ "$XDEBUG" != "false" ];
then
if [ "$XDEBUG" != "false" ];
then
inifile="/usr/local/etc/php/conf.d/pecl-xdebug.ini"
extfile="$(find /usr/local/lib/php/extensions/ -name xdebug.so)";
remote_port="${XDEBUG_IDEKEY:-9000}";
idekey="${XDEBUG_IDEKEY:-xdbg}";
inifile="/usr/local/etc/php/conf.d/pecl-xdebug.ini"
extfile="$(find /usr/local/lib/php/extensions/ -name xdebug.so)";
remote_port="${XDEBUG_IDEKEY:-9000}";
idekey="${XDEBUG_IDEKEY:-xdbg}";
if [ -f "$extfile" ] && [ ! -f "$inifile" ];
then
{
echo "[Xdebug]";
echo "zend_extension=${extfile}";
echo "xdebug.idekey=${idekey}";
echo "xdebug.remote_enable=1";
echo "xdebug.remote_connect_back=1";
echo "xdebug.remote_autostart=1";
echo "xdebug.remote_port=${remote_port}";
} > $inifile;
fi
unset extfile remote_port idekey;
if [ -f "$extfile" ] && [ ! -f "$inifile" ];
then
{
echo "[Xdebug]";
echo "zend_extension=${extfile}";
echo "xdebug.idekey=${idekey}";
echo "xdebug.remote_enable=1";
echo "xdebug.remote_connect_back=1";
echo "xdebug.remote_autostart=1";
echo "xdebug.remote_port=${remote_port}";
} > $inifile;
fi
unset extfile remote_port idekey;
fi
#
......@@ -70,7 +64,7 @@ then
gid=$(stat -c %g "$volume")
fi
if [ -n "$uid" ] && [ "$WORDPRESS_WP_DEBUG" = "true" ];
if [ -n "$uid" ] && [ "$WORDPRESS_DEBUG" = "true" ];
then
user=$(awk -F: "/:$uid:[0-9]+:/{ print \$1}" /etc/passwd)
group=$(awk -F: "/:x:$gid:/{ print \$1}" /etc/group)
......@@ -98,4 +92,4 @@ for f in /docker-entrypoint-extra/*; do
echo
done
exec "$@"
\ No newline at end of file
exec "$@"
<?php
define('DB_USER', getenv('DB_USER') ?: 'wordpress');
define('DB_NAME', getenv('DB_NAME') ?: 'wordpress');
define('DB_PASSWORD', getenv('DB_PASSWORD') ?: 'wordpress');
define('DB_HOST', getenv('DB_HOST') ?: 'mysql');
define('DB_CHARSET', getenv('DB_CHARSET') ?: 'utf8');
define('DB_COLLATE', getenv('DB_COLLATE') ?: '');
define('AUTH_KEY', getenv('AUTH_KEY'));
define('SECURE_AUTH_KEY', getenv('SECURE_AUTH_KEY'));
define('LOGGED_IN_KEY', getenv('LOGGED_IN_KEY'));
define('NONCE_KEY', getenv('NONCE_KEY'));
define('AUTH_SALT', getenv('AUTH_SALT'));
define('SECURE_AUTH_SALT', getenv('SECURE_AUTH_SALT'));
define('LOGGED_IN_SALT', getenv('LOGGED_IN_SALT'));
define('NONCE_SALT', getenv('NONCE_SALT'));
define('FS_METHOD', getenv('FS_METHOD') ?: 'direct');
$table_prefix = getenv('TABLE_PREFIX') ?: 'wp_';
define('WP_DEBUG', getenv('WP_DEBUG') === 'true');
define('WP_DEBUG_LOG', getenv('WP_DEBUG_LOG') === 'true');
define('WP_DEBUG_DISPLAY', getenv('WP_DEBUG_DISPLAY') === 'true');
if ( !defined('ABSPATH') )
define('DB_USER', getenv('WORDPRESS_DB_USER') ?: 'wordpress');
define('DB_NAME', getenv('WORDPRESS_DB_NAME') ?: 'wordpress');
define('DB_PASSWORD', getenv('WORDPRESS_DB_PASSWORD') ?: 'wordpress');
define('DB_HOST', getenv('WORDPRESS_DB_HOST') ?: 'mysql');
define('DB_CHARSET', getenv('WORDPRESS_DB_CHARSET') ?: 'utf8');
define('DB_COLLATE', getenv('WORDPRESS_DB_COLLATE') ?: '');
define('AUTH_KEY', getenv('WORDPRESS_AUTH_KEY'));
define('SECURE_AUTH_KEY', getenv('WORDPRESS_SECURE_AUTH_KEY'));
define('LOGGED_IN_KEY', getenv('WORDPRESS_LOGGED_IN_KEY'));
define('NONCE_KEY', getenv('WORDPRESS_NONCE_KEY'));
define('AUTH_SALT', getenv('WORDPRESS_AUTH_SALT'));
define('SECURE_AUTH_SALT', getenv('WORDPRESS_SECURE_AUTH_SALT'));
define('LOGGED_IN_SALT', getenv('WORDPRESS_LOGGED_IN_SALT'));
define('NONCE_SALT', getenv('WORDPRESS_NONCE_SALT'));
define('FS_METHOD', getenv('WORDPRESS_FS_METHOD') ?: 'direct');
$table_prefix = getenv('WORDPRESS_TABLE_PREFIX') ?: 'wp_';
define('WP_DEBUG', getenv('WORDPRESS_DEBUG') === 'true');
define('WP_DEBUG_LOG', getenv('WORDPRESS_DEBUG_LOG') === 'true');
define('WP_DEBUG_DISPLAY', getenv('WORDPRESS_DEBUG_DISPLAY') === 'true');
if ( !WP_DEBUG_LOG ) {
ini_set('log_errors', 1);
ini_set('error_log', 'php://stderr');
}
if ( !defined('ABSPATH') ) {
define('ABSPATH', dirname(__FILE__) . '/');
}
if(getenv('HTTPS') === 'on') {
$_SERVER['HTTPS'] = 'on';
}
if (strpos($_SERVER['HTTP_X_FORWARDED_PROTO'], 'https') !== false) {
if (isset($_SERVER['HTTP_X_FORWARDED_PROTO'])
&& strpos($_SERVER['HTTP_X_FORWARDED_PROTO'], 'https') !== false) {
$_SERVER['HTTPS'] = 'on';
}
if (file_exists(ABSPATH . 'wp-config-extra.php')) {
include(ABSPATH . 'wp-config-extra.php');
}
require_once(ABSPATH . 'wp-settings.php');
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment