From 4cbe5f1f54cf3ee4f9016f7269e88a90b01d439d Mon Sep 17 00:00:00 2001 From: Yuri Salimovskiy Date: Thu, 24 Nov 2022 16:22:22 +0200 Subject: [PATCH] example using .env with MSM --- docs/advanced-usage/env-support.md | 62 +++++++++++++++++++++++++++++- 1 file changed, 61 insertions(+), 1 deletion(-) diff --git a/docs/advanced-usage/env-support.md b/docs/advanced-usage/env-support.md index 17933c04a..565328489 100644 --- a/docs/advanced-usage/env-support.md +++ b/docs/advanced-usage/env-support.md @@ -50,7 +50,67 @@ $config['save_tmpl_files'] = 'y'; $config['base_url'] = $_ENV['BASE_URL']; $config['site_url'] = $config['base_url']; -$config['app_version'] = '7.0.0-rc.1'; +$config['app_version'] = '7.2.0'; +$config['encryption_key'] = 'bb748b72de235352315122d00'; +$config['session_crypt_key'] = '985796e4444444563463e2c80242'; + +$config['database'] = array( + 'expressionengine' => array( + 'hostname' => $_ENV['DB_HOSTNAME'], + 'database' => $_ENV['DB_DATABASE'], + 'username' => $_ENV['DB_USERNAME'], + 'password' => $_ENV['DB_PASSWORD'], + 'dbprefix' => 'exp_', + 'char_set' => 'utf8mb4', + 'dbcollat' => 'utf8mb4_unicode_ci', + 'port' => $_ENV['DB_PORT'], + ), +); +$config['show_ee_news'] = 'y'; + +// EOF +``` + +## MSM Example + +If your ExpressionEngine installation is hosting multiple sites, you can specify different values for MSM sites configuiration by using site short name as prefix. + +Th site short name can be accessed in the code using `$GLOBALS['assign_to_config']['site_name']` variable. + +The below example demonstrates this approach, assuming you have 2 MSM sites with short names of `default_site` and `second_site` + +``` +# .env.php + +# SITE-SPECIFIC SETTINGS + +default_site.BASE_PATH=/home/sites/mysite.test/ +default_site.BASE_URL=http://mysite.test/ + +second_site.BASE_PATH=/home/sites/anothersite.test/ +second_site.BASE_URL=http://anothersite.test/ + +# DATABASE SETTINGS +# # # # # # # # # # # # +DB_HOSTNAME=db +DB_DATABASE=db +DB_USERNAME=db +DB_PASSWORD=db +DB_PORT=3306 +``` + +``` +// system/user/config.php +