mirror of
https://github.com/shlinkio/shlink.git
synced 2026-02-28 04:03:12 +08:00
Remove app_options config
This commit is contained in:
@@ -43,7 +43,7 @@ RUN apk add --no-cache git && \
|
|||||||
php composer.phar install --no-dev --prefer-dist --optimize-autoloader --no-progress --no-interaction && \
|
php composer.phar install --no-dev --prefer-dist --optimize-autoloader --no-progress --no-interaction && \
|
||||||
php composer.phar clear-cache && \
|
php composer.phar clear-cache && \
|
||||||
rm -r docker composer.* && \
|
rm -r docker composer.* && \
|
||||||
sed -i "s/%SHLINK_VERSION%/${SHLINK_VERSION}/g" config/autoload/app_options.global.php
|
sed -i "s/%SHLINK_VERSION%/${SHLINK_VERSION}/g" module/Core/src/Config/Options/AppOptions.php
|
||||||
|
|
||||||
|
|
||||||
# Prepare final image
|
# Prepare final image
|
||||||
|
|||||||
4
build.sh
4
build.sh
@@ -35,8 +35,8 @@ ${composerBin} install --no-dev --prefer-dist --optimize-autoloader --no-progres
|
|||||||
echo 'Deleting dev files...'
|
echo 'Deleting dev files...'
|
||||||
rm composer.*
|
rm composer.*
|
||||||
|
|
||||||
# Update Shlink version in config
|
# Update Shlink version
|
||||||
sed -i "s/%SHLINK_VERSION%/${version}/g" config/autoload/app_options.global.php
|
sed -i "s/%SHLINK_VERSION%/${version}/g" module/Core/src/Config/Options/AppOptions.php
|
||||||
|
|
||||||
# Compressing file
|
# Compressing file
|
||||||
echo 'Compressing files...'
|
echo 'Compressing files...'
|
||||||
|
|||||||
@@ -1,14 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
use Shlinkio\Shlink\Core\Config\EnvVars;
|
|
||||||
|
|
||||||
return [
|
|
||||||
|
|
||||||
'app_options' => [
|
|
||||||
'name' => 'Shlink',
|
|
||||||
'version' => EnvVars::isDevEnv() ? 'latest' : '%SHLINK_VERSION%',
|
|
||||||
],
|
|
||||||
|
|
||||||
];
|
|
||||||
@@ -8,7 +8,6 @@ use Laminas\ServiceManager\AbstractFactory\ConfigAbstractFactory;
|
|||||||
use Laminas\ServiceManager\Factory\InvokableFactory;
|
use Laminas\ServiceManager\Factory\InvokableFactory;
|
||||||
use Psr\EventDispatcher\EventDispatcherInterface;
|
use Psr\EventDispatcher\EventDispatcherInterface;
|
||||||
use Shlinkio\Shlink\Common\Doctrine\EntityRepositoryFactory;
|
use Shlinkio\Shlink\Common\Doctrine\EntityRepositoryFactory;
|
||||||
use Shlinkio\Shlink\Config\Factory\ValinorConfigFactory;
|
|
||||||
use Shlinkio\Shlink\Core\Config\Options\NotFoundRedirectOptions;
|
use Shlinkio\Shlink\Core\Config\Options\NotFoundRedirectOptions;
|
||||||
use Shlinkio\Shlink\Core\ShortUrl\Helper\ShortUrlStringifier;
|
use Shlinkio\Shlink\Core\ShortUrl\Helper\ShortUrlStringifier;
|
||||||
use Shlinkio\Shlink\Importer\ImportedLinksProcessorInterface;
|
use Shlinkio\Shlink\Importer\ImportedLinksProcessorInterface;
|
||||||
@@ -24,7 +23,7 @@ return [
|
|||||||
ErrorHandler\NotFoundRedirectHandler::class => ConfigAbstractFactory::class,
|
ErrorHandler\NotFoundRedirectHandler::class => ConfigAbstractFactory::class,
|
||||||
ErrorHandler\NotFoundTemplateHandler::class => InvokableFactory::class,
|
ErrorHandler\NotFoundTemplateHandler::class => InvokableFactory::class,
|
||||||
|
|
||||||
Config\Options\AppOptions::class => [ValinorConfigFactory::class, 'config.app_options'],
|
Config\Options\AppOptions::class => [Config\Options\AppOptions::class, 'fromEnv'],
|
||||||
Config\Options\DeleteShortUrlsOptions::class => [Config\Options\DeleteShortUrlsOptions::class, 'fromEnv'],
|
Config\Options\DeleteShortUrlsOptions::class => [Config\Options\DeleteShortUrlsOptions::class, 'fromEnv'],
|
||||||
Config\Options\NotFoundRedirectOptions::class => [Config\Options\NotFoundRedirectOptions::class, 'fromEnv'],
|
Config\Options\NotFoundRedirectOptions::class => [Config\Options\NotFoundRedirectOptions::class, 'fromEnv'],
|
||||||
Config\Options\RedirectOptions::class => [Config\Options\RedirectOptions::class, 'fromEnv'],
|
Config\Options\RedirectOptions::class => [Config\Options\RedirectOptions::class, 'fromEnv'],
|
||||||
|
|||||||
@@ -4,14 +4,22 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace Shlinkio\Shlink\Core\Config\Options;
|
namespace Shlinkio\Shlink\Core\Config\Options;
|
||||||
|
|
||||||
|
use Shlinkio\Shlink\Core\Config\EnvVars;
|
||||||
|
|
||||||
use function sprintf;
|
use function sprintf;
|
||||||
|
|
||||||
final class AppOptions
|
final class AppOptions
|
||||||
{
|
{
|
||||||
public function __construct(public string $name = 'Shlink', public string $version = '3.0.0')
|
public function __construct(public string $name = 'Shlink', public string $version = '4.0.0')
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function fromEnv(): self
|
||||||
|
{
|
||||||
|
$version = EnvVars::isDevEnv() ? 'latest' : '%SHLINK_VERSION%';
|
||||||
|
return new self(version: $version);
|
||||||
|
}
|
||||||
|
|
||||||
public function __toString(): string
|
public function __toString(): string
|
||||||
{
|
{
|
||||||
return sprintf('%s:v%s', $this->name, $this->version);
|
return sprintf('%s:v%s', $this->name, $this->version);
|
||||||
|
|||||||
Reference in New Issue
Block a user