Created HealthAction

This commit is contained in:
Alejandro Celaya
2018-12-23 10:18:38 +01:00
parent 29d49dfbf4
commit 3f65ef998c
9 changed files with 90 additions and 4 deletions

View File

@@ -5,10 +5,12 @@ namespace Shlinkio\Shlink\Rest;
use Zend\Config\Factory;
use Zend\Stdlib\Glob;
use function sprintf;
class ConfigProvider
{
const ROUTES_PREFIX = '/rest/v{version:1}';
private const ROUTES_PREFIX = '/rest';
private const ROUTES_VERSION_PARAM = '/v{version:1}';
public function __invoke()
{
@@ -23,7 +25,14 @@ class ConfigProvider
// Prepend the routes prefix to every path
foreach ($routes as $key => $route) {
$routes[$key]['path'] = self::ROUTES_PREFIX . $route['path'];
['can_be_versioned' => $routeCanBeVersioned, 'path' => $path] = $route;
$routes[$key]['path'] = sprintf(
'%s%s%s',
self::ROUTES_PREFIX,
$routeCanBeVersioned ? self::ROUTES_VERSION_PARAM : '',
$path
);
unset($routes[$key]['can_be_versioned']);
}
return $config;