fix: correct Grav multi-site setup and rename governance to charters
- 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 <crush@charm.land>
This commit is contained in:
55
setup.php
55
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 [];
|
||||
|
||||
Reference in New Issue
Block a user