chore: support configurable api port

This commit is contained in:
wushumin
2026-06-04 13:11:43 +08:00
parent 55c357f2c2
commit 42d86e4c66
2 changed files with 29 additions and 2 deletions

View File

@@ -125,7 +125,10 @@ class MaterialLocalResourceService
}
if (!in_array(strtolower((string)($_ENV['APP_ENV'] ?? '')), ['production', 'prod'], true)) {
return 'http://' . '127.0.0.' . '1:8787';
$port = filter_var($_ENV['APP_PORT'] ?? '', FILTER_VALIDATE_INT, [
'options' => ['min_range' => 1, 'max_range' => 65535],
]) ?: 8787;
return 'http://' . '127.0.0.' . '1:' . $port;
}
return '';