Skip to content
Merged
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
8 changes: 8 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -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
# ============================================
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.4.2
1.4.3
34 changes: 22 additions & 12 deletions docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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'
<?php
header('Content-Type: application/json');
echo json_encode(['status' => '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
Expand Down
2 changes: 1 addition & 1 deletion php/php.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down