fix: add support of module name aliases in the router
This commit is contained in:
parent
7a34d841cc
commit
abd4773e16
1 changed files with 7 additions and 5 deletions
|
@ -29,13 +29,15 @@ function generateHelp($selectedModule) {
|
|||
$modules = $config['modules'];
|
||||
$selectedModule = null;
|
||||
|
||||
foreach ($modules as $key => $module) {
|
||||
if (strpos($_SERVER['HTTP_HOST'], $key . '.') === 0) {
|
||||
foreach ($modules as $moduleName => $module) {
|
||||
foreach (array_merge([$moduleName], $module['alias'] ?? []) as $alias) {
|
||||
if (strpos($_SERVER['HTTP_HOST'], $alias . '.') === 0) {
|
||||
$selectedModule = $module;
|
||||
$selectedModule['key'] = $key;
|
||||
$selectedModule['key'] = $moduleName;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($selectedModule === null) {
|
||||
http_response_code(404);
|
||||
|
|
Loading…
Reference in a new issue