mirror of
https://github.com/shlinkio/shlink.git
synced 2025-03-14 04:00:57 +03:00
Everything configured to generate routes from CLI
This commit is contained in:
parent
a60a6ccc4d
commit
dfdb06d340
7 changed files with 30 additions and 19 deletions
|
@ -1,5 +1,7 @@
|
|||
# Application
|
||||
APP_ENV=
|
||||
SHORTENED_URL_SCHEMA=
|
||||
SHORTENED_URL_HOSTNAME=
|
||||
|
||||
# Database
|
||||
DB_USER=
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
<?php
|
||||
use Acelaya\UrlShortener\Middleware\CliRoutable;
|
||||
|
||||
return [
|
||||
|
||||
'routes' => [
|
||||
[
|
||||
'name' => 'cli',
|
||||
'path' => '/command-name',
|
||||
'middleware' => function ($req, $resp) {
|
||||
|
||||
},
|
||||
'name' => 'cli-generate-shortcode',
|
||||
'path' => '/generate-shortcode',
|
||||
'middleware' => CliRoutable\GenerateShortcodeMiddleware::class,
|
||||
'allowed_methods' => ['CLI'],
|
||||
],
|
||||
],
|
||||
|
|
|
@ -3,14 +3,12 @@
|
|||
return [
|
||||
|
||||
'routes' => [
|
||||
[
|
||||
'name' => 'home',
|
||||
'path' => '/',
|
||||
'middleware' => function ($req, $resp) {
|
||||
|
||||
},
|
||||
'allowed_methods' => ['GET'],
|
||||
],
|
||||
// [
|
||||
// 'name' => 'home',
|
||||
// 'path' => '/',
|
||||
// 'middleware' => '',
|
||||
// 'allowed_methods' => ['GET'],
|
||||
// ],
|
||||
],
|
||||
|
||||
];
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
<?php
|
||||
use Acelaya\UrlShortener\Factory\CacheFactory;
|
||||
use Acelaya\UrlShortener\Factory\EntityManagerFactory;
|
||||
use Acelaya\UrlShortener\Middleware;
|
||||
use Acelaya\UrlShortener\Service\UrlShortener;
|
||||
use Acelaya\ZsmAnnotatedServices\Factory\V3\AnnotatedFactory;
|
||||
use Doctrine\Common\Cache\Cache;
|
||||
|
@ -19,12 +20,11 @@ return [
|
|||
'factories' => [
|
||||
Application::class => Container\ApplicationFactory::class,
|
||||
|
||||
// Routes
|
||||
// Url helpers
|
||||
Helper\UrlHelper::class => Helper\UrlHelperFactory::class,
|
||||
Helper\ServerUrlMiddleware::class => Helper\ServerUrlMiddlewareFactory::class,
|
||||
Helper\UrlHelperMiddleware::class => Helper\UrlHelperMiddlewareFactory::class,
|
||||
Helper\ServerUrlHelper::class => InvokableFactory::class,
|
||||
Router\RouterInterface::class => InvokableFactory::class,
|
||||
Router\AuraRouter::class => InvokableFactory::class,
|
||||
|
||||
// View
|
||||
|
@ -36,10 +36,14 @@ return [
|
|||
GuzzleHttp\Client::class => InvokableFactory::class,
|
||||
UrlShortener::class => AnnotatedFactory::class,
|
||||
Cache::class => CacheFactory::class,
|
||||
|
||||
// Middleware
|
||||
Middleware\CliRoutable\GenerateShortcodeMiddleware::class => AnnotatedFactory::class,
|
||||
],
|
||||
'aliases' => [
|
||||
'em' => EntityManager::class,
|
||||
'httpClient' => GuzzleHttp\Client::class,
|
||||
Router\RouterInterface::class => Router\AuraRouter::class,
|
||||
]
|
||||
],
|
||||
|
||||
|
|
9
config/autoload/url-shortener.global.php
Normal file
9
config/autoload/url-shortener.global.php
Normal file
|
@ -0,0 +1,9 @@
|
|||
<?php
|
||||
return [
|
||||
|
||||
'url-shortener' => [
|
||||
'schema' => getenv('SHORTENED_URL_SCHEMA') ?: 'http',
|
||||
'hostname' => getenv('SHORTENED_URL_HOSTNAME'),
|
||||
],
|
||||
|
||||
];
|
|
@ -29,6 +29,4 @@ if (is_file($cachedConfigFile)) {
|
|||
}
|
||||
}
|
||||
|
||||
// Return an ArrayObject so we can inject the config as a service in Aura.Di
|
||||
// and still use array checks like ``is_array``.
|
||||
return new ArrayObject($config, ArrayObject::ARRAY_AS_PROPS);
|
||||
return $config;
|
||||
|
|
|
@ -27,7 +27,7 @@ class ShortUrl extends AbstractEntity
|
|||
protected $shortCode;
|
||||
/**
|
||||
* @var \DateTime
|
||||
* @ORM\Column(name="date_created", )
|
||||
* @ORM\Column(name="date_created", type="datetime")
|
||||
*/
|
||||
protected $dateCreated;
|
||||
/**
|
||||
|
|
Loading…
Add table
Reference in a new issue