customer-riverside/web/sites/default/settings.php

69 lines
2.4 KiB
PHP
Raw Permalink Normal View History

2026-04-19 20:33:56 -08:00
<?php
$databases['default']['default'] = [
'driver' => 'pgsql',
'database' => getenv('DB_NAME') ?: 'drupal',
'username' => getenv('DB_USER') ?: 'drupal',
'password' => getenv('DB_PASS') ?: 'drupal',
'host' => getenv('DB_HOST') ?: 'postgres',
'port' => '5432',
'prefix' => '',
'namespace' => 'Drupal\\pgsql\\Driver\\Database\\pgsql',
'autoload' => 'core/modules/pgsql/src/Driver/Database/pgsql/',
];
// Outside the web root — safe from direct HTTP access.
$settings['config_sync_directory'] = '/var/www/html/config/sync';
$settings['hash_salt'] = getenv('HASH_SALT') ?: 'replace-this-in-production';
$settings['update_free_access'] = FALSE;
Add email field to booking form + dev mail mocking - Add required email input (with autocomplete="email") to the booking details form in the homepage Preact widget (rpt-booking.js). Update EMPTY_FORM, submit payload, confirmedAppointment, and success summary to include it. The form now collects: first/last name, email, phone, comments. - Update ScheduleController::storeSlot to extract/pass email in the booking_request mail params (and require it for the full-contact path). Log failures with details; return a structured error with a user-friendly message instead of bare "mail_failed". - riverside_pt_mail hook now includes the user's email in the notification body (when provided). - Dev improvements for mail: - In DEBUG mode (default on localhost), force php_mail interface in settings.php so the mailer uses the sendmail_path override. - Dockerfile + entrypoint.sh now provide/install a fake-sendmail.sh that prints the full email (To, Subject, headers, body from the hook) to stderr (visible in `docker compose logs`) and always succeeds (exit 0). This prevents "sh: 1: /usr/sbin/sendmail: not found" and guarantees booking submissions never return the "unable to send confirmation email" error in dev. - In non-DEBUG, still uses symfony_mailer + Postmark as before. - The fake is also baked into the image for consistency. - JS error handling now prefers the server-provided 'message' from the JSON error response (better UX for real mail failures). - Update CLAUDE.md with the new email field + dev mail mocking behavior. - New file: docker/php/fake-sendmail.sh (the mock). This addresses the recent "mail_failed" issues while keeping production email via Postmark.
2026-06-03 22:05:06 -08:00
$is_dev = (bool) getenv('DEBUG');
$postmark_key = getenv('POSTMARK_API_KEY');
2026-06-04 21:52:41 -08:00
Add email field to booking form + dev mail mocking - Add required email input (with autocomplete="email") to the booking details form in the homepage Preact widget (rpt-booking.js). Update EMPTY_FORM, submit payload, confirmedAppointment, and success summary to include it. The form now collects: first/last name, email, phone, comments. - Update ScheduleController::storeSlot to extract/pass email in the booking_request mail params (and require it for the full-contact path). Log failures with details; return a structured error with a user-friendly message instead of bare "mail_failed". - riverside_pt_mail hook now includes the user's email in the notification body (when provided). - Dev improvements for mail: - In DEBUG mode (default on localhost), force php_mail interface in settings.php so the mailer uses the sendmail_path override. - Dockerfile + entrypoint.sh now provide/install a fake-sendmail.sh that prints the full email (To, Subject, headers, body from the hook) to stderr (visible in `docker compose logs`) and always succeeds (exit 0). This prevents "sh: 1: /usr/sbin/sendmail: not found" and guarantees booking submissions never return the "unable to send confirmation email" error in dev. - In non-DEBUG, still uses symfony_mailer + Postmark as before. - The fake is also baked into the image for consistency. - JS error handling now prefers the server-provided 'message' from the JSON error response (better UX for real mail failures). - Update CLAUDE.md with the new email field + dev mail mocking behavior. - New file: docker/php/fake-sendmail.sh (the mock). This addresses the recent "mail_failed" issues while keeping production email via Postmark.
2026-06-03 22:05:06 -08:00
if ($is_dev) {
$config['system.mail']['interface']['default'] = 'php_mail';
} else {
if (!$postmark_key) {
throw new \RuntimeException('POSTMARK_API_KEY is not set — refusing to start without a mail transport.');
}
$config['system.mail']['interface']['default'] = 'symfony_mailer';
$config['system.mail']['mailer_dsn'] = [
'scheme' => 'postmark+smtp',
'host' => 'default',
'user' => $postmark_key,
'password' => NULL,
'port' => NULL,
'options' => [],
];
Add email field to booking form + dev mail mocking - Add required email input (with autocomplete="email") to the booking details form in the homepage Preact widget (rpt-booking.js). Update EMPTY_FORM, submit payload, confirmedAppointment, and success summary to include it. The form now collects: first/last name, email, phone, comments. - Update ScheduleController::storeSlot to extract/pass email in the booking_request mail params (and require it for the full-contact path). Log failures with details; return a structured error with a user-friendly message instead of bare "mail_failed". - riverside_pt_mail hook now includes the user's email in the notification body (when provided). - Dev improvements for mail: - In DEBUG mode (default on localhost), force php_mail interface in settings.php so the mailer uses the sendmail_path override. - Dockerfile + entrypoint.sh now provide/install a fake-sendmail.sh that prints the full email (To, Subject, headers, body from the hook) to stderr (visible in `docker compose logs`) and always succeeds (exit 0). This prevents "sh: 1: /usr/sbin/sendmail: not found" and guarantees booking submissions never return the "unable to send confirmation email" error in dev. - In non-DEBUG, still uses symfony_mailer + Postmark as before. - The fake is also baked into the image for consistency. - JS error handling now prefers the server-provided 'message' from the JSON error response (better UX for real mail failures). - Update CLAUDE.md with the new email field + dev mail mocking behavior. - New file: docker/php/fake-sendmail.sh (the mock). This addresses the recent "mail_failed" issues while keeping production email via Postmark.
2026-06-03 22:05:06 -08:00
}
2026-04-19 20:33:56 -08:00
// Disable CSS/JS aggregation — assets served directly from source paths.
$config['system.performance']['css']['preprocess'] = FALSE;
$config['system.performance']['js']['preprocess'] = FALSE;
2026-05-24 18:23:05 -08:00
if (getenv('DEBUG')) {
$settings['container_yamls'][] = DRUPAL_ROOT . '/sites/development.services.yml';
$settings['cache']['bins']['render'] = 'cache.backend.null';
$settings['cache']['bins']['dynamic_page_cache'] = 'cache.backend.null';
$settings['cache']['bins']['page'] = 'cache.backend.null';
}
// Always allow localhost variants so missing/malformed BASE_URL never locks out local dev.
$settings['trusted_host_patterns'] = ['^localhost$', '^localhost:\d+$', '^127\.0\.0\.1$', '^127\.0\.0\.1:\d+$'];
2026-05-16 10:45:33 -08:00
if ($base = getenv('BASE_URL')) {
// Ensure scheme is present so parse_url extracts host/port correctly.
if (!preg_match('#^https?://#', $base)) {
$base = 'http://' . $base;
}
2026-05-16 10:45:33 -08:00
$base_url = $base;
$parsed = parse_url($base);
$host = $parsed['host'] ?? '';
$port = isset($parsed['port']) ? ':' . $parsed['port'] : '';
if ($host && $host !== 'localhost' && !preg_match('/^127\./', $host)) {
$settings['trusted_host_patterns'][] = '^' . preg_quote($host . $port, '/') . '$';
}
2026-04-19 20:33:56 -08:00
}