fix: add support of module name aliases in the router

This commit is contained in:
Matthieu Bessat 2021-08-08 20:29:34 +02:00
parent 7a34d841cc
commit abd4773e16

View file

@ -29,11 +29,13 @@ function generateHelp($selectedModule) {
$modules = $config['modules']; $modules = $config['modules'];
$selectedModule = null; $selectedModule = null;
foreach ($modules as $key => $module) { foreach ($modules as $moduleName => $module) {
if (strpos($_SERVER['HTTP_HOST'], $key . '.') === 0) { foreach (array_merge([$moduleName], $module['alias'] ?? []) as $alias) {
$selectedModule = $module; if (strpos($_SERVER['HTTP_HOST'], $alias . '.') === 0) {
$selectedModule['key'] = $key; $selectedModule = $module;
break; $selectedModule['key'] = $moduleName;
break;
}
} }
} }