Skip to content

Commit

Permalink
Stinky defaults in env. Peee-ew
Browse files Browse the repository at this point in the history
  • Loading branch information
almunnings committed Oct 21, 2023
1 parent bee4679 commit f2deaf0
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 37 deletions.
18 changes: 9 additions & 9 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Defaults to production.
ENVIRONMENT_TYPE=development
ENVIRONMENT_TYPE=

# Drush configuration.
DRUSH_OPTIONS_URI="https://${LANDO_APP_NAME}.${LANDO_DOMAIN}"
DRUSH_OPTIONS_URI=
DRUSH_OPTIONS_ROOT=

# Enable shield credentials.
Expand All @@ -24,12 +24,12 @@ DRUPAL_CONFIG_DIR=
DRUPAL_TMP_DIR=

# Database.
MARIADB_DATABASE=drupal10
MARIADB_USER=drupal10
MARIADB_PASSWORD=drupal10
MARIADB_HOST=database
MARIADB_PORT=3306
MARIADB_DATABASE=
MARIADB_USER=
MARIADB_PASSWORD=
MARIADB_HOST=
MARIADB_PORT=

# Memcache.
MEMCACHE_SERVER=memcached
MEMCACHE_PORT=11211
MEMCACHE_SERVER=
MEMCACHE_PORT=
32 changes: 15 additions & 17 deletions .lando.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
name: drupal-boilerplate

recipe: drupal10

config:
Expand All @@ -15,20 +14,13 @@ proxy:
# Change drupal-boilerplate to match "name:" when renaming project.
- "node.drupal-boilerplate.lndo.site:3000"

tooling:
npm:
service: node
description: Run NPM commands within the node service.

theme:
service: node
description: Run NPM commands for the theme.
dir: /app/web/themes/contrib/dvb
cmd: npm

services:
appserver:
healthcheck: drush sql:query ';'
overrides:
environment:
ENVIRONMENT_TYPE: development
DRUSH_OPTIONS_URI: "https://drupal-boilerplate.lndo.site"

database:
type: mariadb:custom
Expand Down Expand Up @@ -57,14 +49,20 @@ services:
port: 3000
scanner: false

tooling:
npm:
service: node
description: Run NPM commands within the node service.

theme:
service: node
description: Run NPM commands for the theme.
dir: /app/web/themes/contrib/dvb
cmd: npm

events:
post-start:
- appserver: >
if ! drush status --field=bootstrap | grep -qi "successful"; then
drush si --existing-config --account-name=admin -y;
# Ensure one node exists for the front page.
drush pm-enable devel_generate -y;
drush genc --bundles=page --skip-fields=field_content 1 0;
drush pm-uninstall devel_generate -y;
fi
5 changes: 4 additions & 1 deletion web/sites/default/services.development.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,13 @@ parameters:
# Specify allowed request methods, specify ['*'] to allow all possible ones.
allowedMethods: ['*']

# Enable CORS for local headless development.
# Enable CORS for headless development.
allowedOriginsPatterns:
- '#\.lndo\.site$#'
- '#\.ddev\.site$#'
- '#\.amazee\.io$#'
- '#\.ironstar\.io$#'
- '#\.platformsh\.site$#'
- '#localhost:\d+$#'

# Sets the Access-Control-Expose-Headers header.
Expand Down
18 changes: 8 additions & 10 deletions web/sites/default/settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,8 @@
// Import sensible Drupal defaults.
include __DIR__ . "/default.settings.php";

// Toggle between development and production settings php.
if (!getenv('ENVIRONMENT_TYPE')) {
putenv('ENVIRONMENT_TYPE=production');
}
// Default environment type.
putenv('ENVIRONMENT_TYPE=' . getenv('ENVIRONMENT_TYPE') ?: 'production');

// Hash salt.
$settings['hash_salt'] = hash('sha256', getenv('DRUPAL_HASH_SALT') ?: getenv('MARIADB_HOST'));
Expand All @@ -36,11 +34,11 @@
// Database connection.
$databases['default']['default'] = [
'driver' => 'mysql',
'database' => getenv('MARIADB_DATABASE'),
'username' => getenv('MARIADB_USER'),
'password' => getenv('MARIADB_PASSWORD'),
'host' => getenv('MARIADB_HOST'),
'port' => getenv('MARIADB_PORT'),
'database' => getenv('MARIADB_DATABASE') ?: 'drupal10',
'username' => getenv('MARIADB_USER') ?: 'drupal10',
'password' => getenv('MARIADB_PASSWORD') ?: 'drupal10',
'host' => getenv('MARIADB_HOST') ?: 'database',
'port' => getenv('MARIADB_PORT') ?: 3306,
'prefix' => '',
'init_commands' => [
'isolation_level' => 'SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED',
Expand All @@ -51,7 +49,7 @@
$settings['config_sync_directory'] = getenv('DRUPAL_CONFIG_DIR') ?: '../config/sync';
$settings['file_public_path'] = getenv('DRUPAL_PUBLIC_DIR') ?: 'sites/default/files';
$settings['file_private_path'] = getenv('DRUPAL_PRIVATE_DIR') ?: 'sites/default/files/private';
$config['system.file']['path']['temporary'] = getenv('DRUPAL_TMP_DIR') ?: getenv('TMP');
$config['system.file']['path']['temporary'] = getenv('DRUPAL_TMP_DIR') ?: getenv('TMP') ?: sys_get_temp_dir();

// Enable all reverse proxies.
$settings['reverse_proxy'] = TRUE;
Expand Down

0 comments on commit f2deaf0

Please sign in to comment.