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 [];