Added env var that can be used to define default short codes length on docker image

This commit is contained in:
Alejandro Celaya
2020-02-18 19:34:01 +01:00
parent 343ee04acb
commit 51e130c7a0
6 changed files with 20 additions and 1 deletions

View File

@@ -32,6 +32,7 @@ class SimplifiedConfigParser
'web_worker_num' => ['mezzio-swoole', 'swoole-http-server', 'options', 'worker_num'],
'task_worker_num' => ['mezzio-swoole', 'swoole-http-server', 'options', 'task_worker_num'],
'visits_webhooks' => ['url_shortener', 'visits_webhooks'],
'default_short_codes_length' => ['url_shortener', 'default_short_codes_length'],
];
private const SIMPLIFIED_CONFIG_SIDE_EFFECTS = [
'delete_short_url_threshold' => [

View File

@@ -10,6 +10,8 @@ use Laminas\InputFilter\InputFilter;
use Laminas\Validator;
use Shlinkio\Shlink\Common\Validation;
use const Shlinkio\Shlink\Core\MIN_SHORT_CODES_LENGTH;
class ShortUrlMetaInputFilter extends InputFilter
{
use Validation\InputFactoryTrait;
@@ -43,7 +45,7 @@ class ShortUrlMetaInputFilter extends InputFilter
$this->add($customSlug);
$this->add($this->createPositiveNumberInput(self::MAX_VISITS));
$this->add($this->createPositiveNumberInput(self::SHORT_CODE_LENGTH, 4));
$this->add($this->createPositiveNumberInput(self::SHORT_CODE_LENGTH, MIN_SHORT_CODES_LENGTH));
$this->add($this->createBooleanInput(self::FIND_IF_EXISTS, false));