diff --git a/.env.example b/.env.example index 4517a3c..92355a4 100644 --- a/.env.example +++ b/.env.example @@ -2,6 +2,14 @@ # PHP API Stack — Environment Configuration # Image: kariricode/php-api-stack # ============================================ +# Demo Mode (optional) +# Set to 'true' to install demo landing page when no application exists +DEMO_MODE=false + +# Health Check Installation (optional) +# Set to 'true' to install health check endpoint +# Automatically enabled when DEMO_MODE=true +HEALTH_CHECK_INSTALL=false # ============================================ # Application # ============================================ diff --git a/VERSION b/VERSION index 9df886c..428b770 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.4.2 +1.4.3 diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh index 93b81f4..9ff0aed 100755 --- a/docker-entrypoint.sh +++ b/docker-entrypoint.sh @@ -202,23 +202,33 @@ fi # Create health check endpoint if doesn't exist if [ ! -f "/var/www/html/public/health.php" ]; then - log_info "Installing health check endpoint..." - - # Copy from template if exists, otherwise create basic fallback - if [ -f "/usr/local/share/php-api-stack/health.php" ]; then - cp /usr/local/share/php-api-stack/health.php /var/www/html/public/health.php - log_info "Health check installed from template" - else - log_warning "Health check template not found, creating basic fallback" - cat > /var/www/html/public/health.php << 'EOF' + # Apenas instala health check se habilitado ou se DEMO_MODE estiver ativo + if [ "${HEALTH_CHECK_INSTALL}" = "true" ] || [ "${DEMO_MODE}" = "true" ]; then + log_info "Installing health check endpoint..." + + # Cria diretório se não existir + mkdir -p /var/www/html/public + + # Copy from template if exists, otherwise create basic fallback + if [ -f "/usr/local/share/php-api-stack/health.php" ]; then + cp /usr/local/share/php-api-stack/health.php /var/www/html/public/health.php + log_info "Health check installed from template" + else + log_warning "Health check template not found, creating basic fallback" + cat > /var/www/html/public/health.php << 'EOF' 'healthy', 'timestamp' => date('c')], JSON_PRETTY_PRINT); EOF + fi + + chown nginx:nginx /var/www/html/public/health.php + chmod 644 /var/www/html/public/health.php + else + log_info "HEALTH_CHECK_INSTALL not enabled - skipping health check installation" fi - - chown nginx:nginx /var/www/html/public/health.php - chmod 644 /var/www/html/public/health.php +else + log_info "Health check already exists at /var/www/html/public/health.php" fi # Set up log rotation apenas uma vez diff --git a/php/php.ini b/php/php.ini index 64469e6..1b64a66 100644 --- a/php/php.ini +++ b/php/php.ini @@ -172,7 +172,7 @@ xdebug.output_dir = /tmp xdebug.log = /var/log/php/xdebug.log ; Security -open_basedir = "/var/www/html:/tmp:/usr/local/lib/php:/usr/share/php:/usr/local/bin:/composer:/root" +open_basedir = "/var:/tmp:/usr:/composer:/root" ; disable_functions = exec,passthru,shell_exec,system,proc_open,popen,curl_exec,curl_multi_exec,parse_ini_file,show_source disable_functions = exec,passthru,shell_exec,system,popen,show_source