mirror of
https://github.com/shlinkio/shlink.git
synced 2025-03-29 13:03:52 +03:00
Created cli-specific services config file
This commit is contained in:
parent
170c96b8ef
commit
7efb3b3a86
3 changed files with 22 additions and 11 deletions
|
@ -1,5 +1,4 @@
|
||||||
<?php
|
<?php
|
||||||
use Shlinkio\Shlink\CLI;
|
|
||||||
use Acelaya\UrlShortener\Factory\CacheFactory;
|
use Acelaya\UrlShortener\Factory\CacheFactory;
|
||||||
use Acelaya\UrlShortener\Factory\EntityManagerFactory;
|
use Acelaya\UrlShortener\Factory\EntityManagerFactory;
|
||||||
use Acelaya\UrlShortener\Middleware;
|
use Acelaya\UrlShortener\Middleware;
|
||||||
|
@ -7,7 +6,6 @@ use Acelaya\UrlShortener\Service;
|
||||||
use Acelaya\ZsmAnnotatedServices\Factory\V3\AnnotatedFactory;
|
use Acelaya\ZsmAnnotatedServices\Factory\V3\AnnotatedFactory;
|
||||||
use Doctrine\Common\Cache\Cache;
|
use Doctrine\Common\Cache\Cache;
|
||||||
use Doctrine\ORM\EntityManager;
|
use Doctrine\ORM\EntityManager;
|
||||||
use Symfony\Component\Console;
|
|
||||||
use Zend\Expressive;
|
use Zend\Expressive;
|
||||||
use Zend\Expressive\Container;
|
use Zend\Expressive\Container;
|
||||||
use Zend\Expressive\Helper;
|
use Zend\Expressive\Helper;
|
||||||
|
@ -21,7 +19,6 @@ return [
|
||||||
'services' => [
|
'services' => [
|
||||||
'factories' => [
|
'factories' => [
|
||||||
Expressive\Application::class => Container\ApplicationFactory::class,
|
Expressive\Application::class => Container\ApplicationFactory::class,
|
||||||
Console\Application::class => CLI\Factory\ApplicationFactory::class,
|
|
||||||
|
|
||||||
// Url helpers
|
// Url helpers
|
||||||
Helper\UrlHelper::class => Helper\UrlHelperFactory::class,
|
Helper\UrlHelper::class => Helper\UrlHelperFactory::class,
|
||||||
|
@ -42,12 +39,6 @@ return [
|
||||||
Service\ShortUrlService::class => AnnotatedFactory::class,
|
Service\ShortUrlService::class => AnnotatedFactory::class,
|
||||||
Cache::class => CacheFactory::class,
|
Cache::class => CacheFactory::class,
|
||||||
|
|
||||||
// Cli commands
|
|
||||||
CLI\Command\GenerateShortcodeCommand::class => AnnotatedFactory::class,
|
|
||||||
CLI\Command\ResolveUrlCommand::class => AnnotatedFactory::class,
|
|
||||||
CLI\Command\ListShortcodesCommand::class => AnnotatedFactory::class,
|
|
||||||
CLI\Command\GetVisitsCommand::class => AnnotatedFactory::class,
|
|
||||||
|
|
||||||
// Middleware
|
// Middleware
|
||||||
Middleware\Routable\RedirectMiddleware::class => AnnotatedFactory::class,
|
Middleware\Routable\RedirectMiddleware::class => AnnotatedFactory::class,
|
||||||
],
|
],
|
||||||
|
@ -56,7 +47,7 @@ return [
|
||||||
'httpClient' => GuzzleHttp\Client::class,
|
'httpClient' => GuzzleHttp\Client::class,
|
||||||
Router\RouterInterface::class => Router\FastRouteRouter::class,
|
Router\RouterInterface::class => Router\FastRouteRouter::class,
|
||||||
AnnotatedFactory::CACHE_SERVICE => Cache::class,
|
AnnotatedFactory::CACHE_SERVICE => Cache::class,
|
||||||
]
|
],
|
||||||
],
|
],
|
||||||
|
|
||||||
];
|
];
|
||||||
|
|
20
module/CLI/config/services.config.php
Normal file
20
module/CLI/config/services.config.php
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
<?php
|
||||||
|
use Acelaya\UrlShortener\Middleware;
|
||||||
|
use Acelaya\ZsmAnnotatedServices\Factory\V3\AnnotatedFactory;
|
||||||
|
use Shlinkio\Shlink\CLI;
|
||||||
|
use Symfony\Component\Console;
|
||||||
|
|
||||||
|
return [
|
||||||
|
|
||||||
|
'services' => [
|
||||||
|
'factories' => [
|
||||||
|
Console\Application::class => CLI\Factory\ApplicationFactory::class,
|
||||||
|
|
||||||
|
CLI\Command\GenerateShortcodeCommand::class => AnnotatedFactory::class,
|
||||||
|
CLI\Command\ResolveUrlCommand::class => AnnotatedFactory::class,
|
||||||
|
CLI\Command\ListShortcodesCommand::class => AnnotatedFactory::class,
|
||||||
|
CLI\Command\GetVisitsCommand::class => AnnotatedFactory::class,
|
||||||
|
],
|
||||||
|
],
|
||||||
|
|
||||||
|
];
|
|
@ -44,7 +44,7 @@ class UrlShortener implements UrlShortenerInterface
|
||||||
) {
|
) {
|
||||||
$this->httpClient = $httpClient;
|
$this->httpClient = $httpClient;
|
||||||
$this->em = $em;
|
$this->em = $em;
|
||||||
$this->chars = $chars;
|
$this->chars = empty($chars) ? self::DEFAULT_CHARS : $chars;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Add table
Reference in a new issue