diff --git a/.env.production.example b/.env.production.example index ec8e1d8..be93f5a 100644 --- a/.env.production.example +++ b/.env.production.example @@ -43,6 +43,8 @@ MAIL_FROM_NAME="${APP_NAME}" FEWO_OWNER_NAME="Brigitte Stommer" FEWO_OWNER_EMAIL=fewo@stommer.de FEWO_NOTIFICATION_EMAIL=fewo@stommer.de +# Nur Testbetrieb: alle E-Mails ausschließlich an diese Adresse (leer = normaler Versand) +FEWO_MAIL_REDIRECT_TO= FEWO_BANK_ACCOUNT_HOLDER= FEWO_BANK_IBAN= FEWO_BANK_BIC= diff --git a/app/Providers/AppServiceProvider.php b/app/Providers/AppServiceProvider.php index 6fe6651..2ef2abf 100644 --- a/app/Providers/AppServiceProvider.php +++ b/app/Providers/AppServiceProvider.php @@ -4,6 +4,7 @@ use App\Support\StripImageMetadata; use Illuminate\Support\Facades\Event; +use Illuminate\Support\Facades\Mail; use Illuminate\Support\Facades\URL; use Illuminate\Support\ServiceProvider; use Spatie\MediaLibrary\MediaCollections\Events\MediaHasBeenAddedEvent; @@ -23,6 +24,11 @@ public function register(): void */ public function boot(): void { + // Test environments: deliver every e-mail to one address only, so no guest gets test mails. + if (filled(config('fewo.mail_redirect_to'))) { + Mail::alwaysTo(config('fewo.mail_redirect_to')); + } + // Photos: remove metadata (GPS position, camera data) from uploaded originals, which stay downloadable. Event::listen(MediaHasBeenAddedEvent::class, fn (MediaHasBeenAddedEvent $event) => StripImageMetadata::strip($event->media)); diff --git a/config/fewo.php b/config/fewo.php index 2c6d294..1a48498 100644 --- a/config/fewo.php +++ b/config/fewo.php @@ -50,6 +50,9 @@ | Further retention periods (docs/LOESCHKONZEPT.md). The defaults are PROPOSALS – please have them | confirmed according to the general legal opinion (tax advisor / legal advice) and adjust here. */ + // Test environments: every e-mail goes to this address only (instead of guests/landlord). Empty = normal delivery. + 'mail_redirect_to' => env('FEWO_MAIL_REDIRECT_TO'), + // Daily database backup (php artisan backup:database): number of dumps kept in storage/app/private/backups. 'backup' => [ 'keep' => (int) env('FEWO_BACKUP_KEEP', 14), diff --git a/public/index.php b/public/index.php index ee8f07e..86df1ce 100644 --- a/public/index.php +++ b/public/index.php @@ -13,6 +13,13 @@ // Register the Composer autoloader... require __DIR__.'/../vendor/autoload.php'; +// Strato: the domain points at the deployment folder and .htaccess forwards to releases//public. +// The script then lives below that path, so the base URL would contain it and signed links would not +// match. The site is always served from the domain root, therefore the script is reported as /index.php. +if (preg_match('~/(releases/[^/]+|current)/public/index\.php$~', $_SERVER['SCRIPT_NAME'] ?? '')) { + $_SERVER['SCRIPT_NAME'] = $_SERVER['PHP_SELF'] = '/index.php'; +} + // Bootstrap Laravel and handle the request... /** @var Application $app */ $app = require_once __DIR__.'/../bootstrap/app.php';