Files
oauth/docker/php/entrypoint.sh
Josep Piguillem 8d5710a726 fix: personal access tokens failed with a 500 in production
Passport needs a "personal access client" to issue personal access tokens,
and only the seeder created it (production runs migrations, not the seeder),
so createToken threw "Personal access client not found".

- New idempotent command passport:ensure-personal-client, run by the
  container entrypoint after the migrations.
- The tokens page now shows an error when the server fails instead of
  doing nothing (es, en, ca).
- Tests: the command creates the client once; tokens can be created.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-07 19:30:40 +02:00

28 lines
775 B
Bash

#!/bin/sh
set -e
cd /var/www/html
if [ "$CONTAINER_ROLE" = "app" ]; then
chown -R www-data:www-data storage bootstrap/cache
if [ ! -f storage/oauth-private.key ]; then
echo "Generando claves de Passport (primer arranque)..."
su-exec www-data php artisan passport:keys
fi
echo "Aplicando migraciones..."
su-exec www-data php artisan migrate --force
echo "Comprobando el cliente de Personal Access Tokens..."
su-exec www-data php artisan passport:ensure-personal-client
echo "Cacheando configuración, rutas y vistas..."
su-exec www-data php artisan config:cache
su-exec www-data php artisan route:cache
su-exec www-data php artisan view:cache
su-exec www-data php artisan l5-swagger:generate
fi
exec "$@"