#!/bin/sh

umask 022

cd /var/www

# Ensure storage symlink exists (recreate if missing or broken)
if [ ! -L /var/www/public/storage ] || [ ! -e /var/www/public/storage ]; then
    rm -rf /var/www/public/storage
    ln -sfn /var/www/storage/app/public /var/www/public/storage
fi

# Cache config (ignore errors)
php artisan config:cache --no-ansi 2>/dev/null || true

exec php-fpm
