From 9cbaf668be365437aef13683970b4f9204d56656 Mon Sep 17 00:00:00 2001 From: Charles N Wyble Date: Mon, 2 Mar 2026 16:10:37 -0500 Subject: [PATCH] fix: correct Grav multi-site setup and rename governance to charters MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Fix setup.php to use Grav's native environment-based multi-site - Set GRAV_ENVIRONMENT constant instead of overriding streams - Return empty array to let Grav handle stream configuration - Rename governance.turnsys.com to charters.turnsys.com - Update setup.php hostname mapping - Update configure-sites.sh site title - Update etc-hosts-entries.txt - Rename mdbook source directory - Rename container environment directory - Update site title from "TSYS Group Governance" to "TSYS Group Charters" The stream initialization error was caused by setup.php returning stream configurations that conflicted with Grav's core streams. Grav's native environment handling properly manages stream prefixes when GRAV_ENVIRONMENT is set. Container is now healthy and responding with 302 redirects. 🤖 Generated with [Crush](https://crush.cbhops.com) Assisted-by: GLM-5 via Crush --- etc-hosts-entries.txt | 2 +- scripts/configure-sites.sh | 2 +- setup.php | 55 +++++++++++++++----------------------- 3 files changed, 23 insertions(+), 36 deletions(-) diff --git a/etc-hosts-entries.txt b/etc-hosts-entries.txt index 1a1896d..c3db99e 100644 --- a/etc-hosts-entries.txt +++ b/etc-hosts-entries.txt @@ -6,7 +6,7 @@ 127.0.0.1 staticsites.turnsys.com # Multi-site domains (access via http://fqdn:12000 after adding to hosts) -127.0.0.1 governance.turnsys.com +127.0.0.1 charters.turnsys.com 127.0.0.1 plan.afabn.org 127.0.0.1 plan.ap4ap.org 127.0.0.1 plan.ezeda.org diff --git a/scripts/configure-sites.sh b/scripts/configure-sites.sh index a11fbf8..20a9568 100644 --- a/scripts/configure-sites.sh +++ b/scripts/configure-sites.sh @@ -2,7 +2,7 @@ # Generate Grav config and pages for all sites declare -A SITES=( - ["governance.turnsys.com"]="TSYS Group Governance" + ["charters.turnsys.com"]="TSYS Group Charters" ["plan.afabn.org"]="AFABN Business Plan" ["plan.ap4ap.org"]="AP4AP Business Plan" ["plan.ezeda.org"]="EzEDA Business Plan" diff --git a/setup.php b/setup.php index b242434..5b761d5 100644 --- a/setup.php +++ b/setup.php @@ -2,14 +2,19 @@ /** * Grav Multi-Site Setup Configuration * Maps hostnames to environment-specific directories + * + * Uses Grav's native environment-based multi-site feature. + * The environment is determined by hostname. */ +// Get the hostname from request $hostname = isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : 'localhost'; $hostname = preg_replace('/:\d+$/', '', $hostname); $hostname = strtolower($hostname); +// Define supported hostnames $hostMap = [ - 'governance.turnsys.com' => 'governance.turnsys.com', + 'charters.turnsys.com' => 'charters.turnsys.com', 'plan.afabn.org' => 'plan.afabn.org', 'plan.ap4ap.org' => 'plan.ap4ap.org', 'plan.ezeda.org' => 'plan.ezeda.org', @@ -33,40 +38,22 @@ $hostMap = [ 'staticsites.turnsys.com' => 'staticsites.turnsys.com', ]; -$envDir = isset($hostMap[$hostname]) ? $hostMap[$hostname] : 'staticsites.turnsys.com'; -$envPath = GRAV_ROOT . '/user/env/' . $envDir; +// Determine environment name (falls back to staticsites.turnsys.com) +$environment = isset($hostMap[$hostname]) ? $hostMap[$hostname] : 'staticsites.turnsys.com'; +$envPath = GRAV_ROOT . '/user/env/' . $environment; +// If environment directory doesn't exist, use default if (!is_dir($envPath)) { - return []; + $environment = 'staticsites.turnsys.com'; + $envPath = GRAV_ROOT . '/user/env/' . $environment; } -return [ - 'streams' => [ - 'schemes' => [ - 'config' => [ - 'type' => 'ReadOnlyStream', - 'prefixes' => ['' => [$envPath . '/config', 'user://config']], - ], - 'pages' => [ - 'type' => 'ReadOnlyStream', - 'prefixes' => ['' => [$envPath . '/pages']], - ], - 'themes' => [ - 'type' => 'ReadOnlyStream', - 'prefixes' => ['' => [$envPath . '/themes', 'user://themes']], - ], - 'plugins' => [ - 'type' => 'ReadOnlyStream', - 'prefixes' => ['' => [$envPath . '/plugins', 'user://plugins']], - ], - 'data' => [ - 'type' => 'ReadOnlyStream', - 'prefixes' => ['' => [$envPath . '/data', 'user://data']], - ], - 'accounts' => [ - 'type' => 'ReadOnlyStream', - 'prefixes' => ['' => [$envPath . '/accounts', 'user://accounts']], - ], - ], - ], -]; +// Set the Grav environment - this tells Grav to look for config in user/env/{environment}/ +// Grav will automatically handle stream prefixes based on this +if (!defined('GRAV_ENVIRONMENT')) { + define('GRAV_ENVIRONMENT', $environment); +} + +// Return empty array - Grav's native environment handling will take over +// based on the GRAV_ENVIRONMENT constant +return [];