Environment Configuration
Scottsdale Mint uses environment-specific PHP files under config/environments/ to apply per-environment overrides on top of config/application.php. The active environment is determined by WP_ENVIRONMENT_TYPE in .env.
How Environments Are Loadedโ
// config/application.php (simplified)
$env = env('WP_ENVIRONMENT_TYPE', 'production');
// Load environment-specific overrides
$env_config = __DIR__ . "/environments/{$env}.php";
if ( file_exists( $env_config ) ) {
require_once $env_config;
}
config/environments/production.phpโ
<?php
/**
* Production environment configuration.
*/
// Suppress all non-fatal errors in production
error_reporting( E_ERROR );
// Disable Query Monitor
Suma_Config_Helper::disable_plugins([
'query-monitor/query-monitor.php',
]);
// Memory limits for Lambda (4096MB available)
define( 'WP_MEMORY_LIMIT', '4096M' );
define( 'WP_MAX_MEMORY_LIMIT', '4096M' );
config/environments/staging.phpโ
<?php
/**
* Staging environment configuration.
*/
error_reporting( E_ERROR );
// Disable plugins not needed on staging
Suma_Config_Helper::disable_plugins([
'woocommerce-follow-up-emails/woocommerce-follow-up-emails.php',
'mainwp-child/mainwp-child.php',
'walmart-integration-for-woocommerce/walmart-woocommerce-integration.php',
]);
// Staging uses separate Algolia index prefix
define( 'ALGOLIA_INDEX_NAME_PREFIX', 'scottsdale_stg_' );
// Memory limits for Lambda (2048MB on staging)
define( 'WP_MEMORY_LIMIT', '4096M' );
define( 'WP_MAX_MEMORY_LIMIT', '4096M' );
config/environments/development.phpโ
<?php
/**
* Development environment configuration.
*/
// Full error reporting for debugging
define( 'SAVEQUERIES', true ); // For Query Monitor
define( 'WP_DISABLE_FATAL_ERROR_HANDLER', true ); // Show full fatal errors
define( 'SCRIPT_DEBUG', true ); // Load unminified assets
// Allow Jetpack to work locally
define( 'JETPACK_DEV_DEBUG', true );
// Disable unnecessary plugins on dev Lambda environment
Suma_Config_Helper::disable_plugins([
'woocommerce-follow-up-emails/woocommerce-follow-up-emails.php',
'mainwp-child/mainwp-child.php',
'walmart-integration-for-woocommerce/walmart-woocommerce-integration.php',
]);
// Dev-specific Algolia index prefix
define( 'ALGOLIA_INDEX_NAME_PREFIX', 'scottsdale_dev_' );
// Dev database defaults (overridden in .env)
define( 'DB_HOST', env('DB_HOST', 'localhost') );
define( 'DB_NAME', env('DB_NAME', 'wp_scottsdale') );
define( 'DB_USER', env('DB_USER', 'root') );
define( 'DB_PASSWORD', env('DB_PASSWORD', '') );
// Local email via MailHog instead of Mailgun
define( 'WPMS_MAILER', 'smtp' );
define( 'WPMS_SMTP_HOST', '127.0.0.1' );
define( 'WPMS_SMTP_PORT', '2525' );
define( 'WPMS_SMTP_USER', 'scottsdalemint.test' );
define( 'WPMS_SMTP_PASS', '123456' );
// Memory limits (dev Lambda has 2048MB)
define( 'WP_MEMORY_LIMIT', '3G' );
define( 'WP_MAX_MEMORY_LIMIT', '3G' );
config/environments/local.phpโ
The local environment (Laravel Herd) inherits development settings and additionally:
// Local Algolia prefix
define( 'ALGOLIA_INDEX_NAME_PREFIX', 'scottsdale_local_v2_' );
// Local Redis (no AUTH token)
define( 'WP_REDIS_CLIENT', env('WP_REDIS_CLIENT', 'phpredis') );
Environment Differences Summaryโ
| Setting | local | development | staging | production |
|---|---|---|---|---|
WP_DEBUG | true | true | false | false |
SCRIPT_DEBUG | true | true | false | false |
SAVEQUERIES | true | true | false | false |
| PHP error reporting | E_ALL | E_ALL | E_ERROR | E_ERROR |
| Algolia prefix | scottsdale_local_v2_ | scottsdale_dev_ | scottsdale_stg_ | scottsdale_prod_ |
| Email routing | MailHog (SMTP) | MailHog (SMTP) | Mailgun | Mailgun |
| Redis client | phpredis | phpredis/relay | relay | relay |
| Redis compression | none | none | zstd | zstd |
| Memory limit | Herd (unlimited) | 3GB | 4GB | 4GB |
| AvaTax commits | Disabled | Disabled | Disabled | Enabled |
| Kount plugin | Enabled | Enabled | Enabled | Disabled (plugin disabler) |
| Query Monitor | Enabled | Enabled | Enabled | Disabled (plugin disabler) |
| Walmart plugin | Disabled | Disabled | Disabled | Disabled |
| Follow-up Emails | Enabled | Disabled | Disabled | Disabled |
| MainWP Child | Enabled | Disabled | Disabled | Disabled |
Suma Patches Dev Module (class-dev.php)โ
The suma-patches plugin's Dev class applies additional per-environment behaviors using WordPress hooks. It runs on all non-production environments to:
- Override the Algolia index name prefix in the database (via
pre_optionfilter) - Override admin email (prevents staging from emailing real customers)
- Add
noindexmeta tag to prevent staging/dev indexing by search engines - Disable AvaTax order recording and commit (
wc_avatax_record_calculations = 'no') - Clear Google Analytics tracking code (prevents staging events polluting GA)
- Configure WP Mail SMTP to use MailHog locally
Adding a New Environment Overrideโ
- Create
config/environments/{environment-name}.php - Set
WP_ENVIRONMENT_TYPE={environment-name}in.env - Add any
define()calls orSuma_Config_Helper::disable_plugins()calls
caution
Environment files are loaded via require_once โ they run at WordPress bootstrap time, before plugins_loaded. Only use define(), Suma_Config_Helper, and similar pre-boot operations here.