Skip to content

Application

DDEV Application configuration for Skpr projects

The application will need to be configured for database conncections and compatability for mailpit.

Note: Other services such as Solr or ElasticSearch are not yet featured here.

We'll be isolating configuration for the sake of DDEV in its own file, so you'll need to include it from the settings.php file. Be careful with the file names if you are already including files via globbing.

An environment variable, IS_DDEV_PROJECT, will be set to true on the application's container, so you may use this to selectively target the settings file inclusion logic.

There's an environment variable you can target for including the file -

And for the main configuration below, we've copied a boilerplate configuration DDEV provides for Drupal 10 sites. We've also changed the credentials to match up with the creds on the database image for local development.

<?php

// Database connection using Skpr Docker images.
$databases['default']['default']['database'] = "local";
$databases['default']['default']['username'] = "local";
$databases['default']['default']['password'] = "local";
$databases['default']['default']['host'] = "database";
$databases['default']['default']['port'] = 3306;
$databases['default']['default']['driver'] = "mysql";

// Prevent Drupal from setting read-only permissions on sites/default.
$settings['skip_permissions_hardening'] = TRUE;

// This will ensure the site can only be accessed through the intended host
// names. Additional host patterns can be added for custom configurations.
$settings['trusted_host_patterns'] = ['.*'];
x
// Don't use Symfony's APCLoader. ddev includes APCu; Composer's APCu loader has
// better performance.
$settings['class_loader_auto_detect'] = FALSE;

// Override drupal/symfony_mailer default config to use Mailpit
$config['symfony_mailer.mailer_transport.sendmail']['plugin'] = 'smtp';
$config['symfony_mailer.mailer_transport.sendmail']['configuration']['user']='';
$config['symfony_mailer.mailer_transport.sendmail']['configuration']['pass']='';
$config['symfony_mailer.mailer_transport.sendmail']['configuration']['host']='localhost';
$config['symfony_mailer.mailer_transport.sendmail']['configuration']['port']='1025';

// Enable verbose logging for errors.
// https://www.drupal.org/forum/support/post-installation/2018-07-18/enable-drupal-8-backend-errorlogdebugging-mode
$config['system.logging']['error_level'] = 'verbose';