Skip to content

Commit

Permalink
GH-420: Initial DDEV support
Browse files Browse the repository at this point in the history
  • Loading branch information
sampoturve committed Aug 13, 2024
1 parent a0a1bfc commit 3ac626f
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 3 deletions.
7 changes: 7 additions & 0 deletions .ddev/commands/web/grumphp-command.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/usr/bin/env bash

## Description: Run a GrumPHP command.
## Usage: grumphp
## Example: "ddev grumphp"

php /var/www/html/vendor/bin/grumphp "$@"
24 changes: 24 additions & 0 deletions .ddev/config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: drupal-project
type: drupal
docroot: web
php_version: "8.2"
webserver_type: nginx-fpm
xdebug_enabled: true
additional_hostnames: []
additional_fqdns: []
database:
type: mariadb
version: "10.11"
use_dns_when_possible: true
composer_version: "2"
disable_settings_management: true
web_environment:
- DB_NAME=db
- DB_USER=db
- DB_PASS=db
- DB_HOST=db
- DRUSH_OPTIONS_URI=https://drupal-project.ddev.site
- ENVIRONMENT_NAME=ddev
- EXEC_GRUMPHP_COMMAND=ddev php
- HASH_SALT=notsosecurehash
corepack_enable: false
5 changes: 3 additions & 2 deletions .lando.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,10 @@ services:
environment:
# Database credentials are defined in the .lando/.env file
# to be available in both the adminer and appserver containers.
HASH_SALT: notsosecurehash
ENVIRONMENT_NAME: lando
DRUSH_OPTIONS_URI: https://drupal-project.lndo.site
ENVIRONMENT_NAME: lando
EXEC_GRUMPHP_COMMAND: "lando php"
HASH_SALT: notsosecurehash
VARNISH_ADMIN_HOST: varnish
# Support debugging with XDEBUG 3.
XDEBUG_MODE:
Expand Down
2 changes: 1 addition & 1 deletion grumphp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,4 @@ grumphp:
- Wunderio\GrumPHP\Task\YamlLint\YamlLintExtensionLoader
- Wunderio\GrumPHP\Task\JsonLint\JsonLintExtensionLoader
git_hook_variables:
EXEC_GRUMPHP_COMMAND: lando php
EXEC_GRUMPHP_COMMAND: ${EXEC_GRUMPHP_COMMAND}
11 changes: 11 additions & 0 deletions web/sites/default/settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
$settings['simple_environment_indicator'] = 'DarkBlue Stage';
break;

case 'ddev':
case 'local':
case 'lando':
$settings['simple_environment_indicator'] = 'DarkGreen Local';
Expand All @@ -72,6 +73,16 @@
$settings['cache']['bins']['dynamic_page_cache'] = 'cache.backend.null';
$settings['cache']['bins']['page'] = 'cache.backend.null';
$settings['extension_discovery_scan_tests'] = FALSE;

// Override drupal/symfony_mailer default config to use Mailpit.
if ($env === 'ddev') {
$config['symfony_mailer.settings']['default_transport'] = 'sendmail';
$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';
}
break;

default:
Expand Down

0 comments on commit 3ac626f

Please sign in to comment.