mirror of
https://github.com/shlinkio/shlink.git
synced 2026-03-10 09:13:11 +08:00
Load specific env file when running API tests
This commit is contained in:
@@ -15,10 +15,11 @@ use const Shlinkio\Shlink\MIN_SHORT_CODES_LENGTH;
|
||||
final readonly class UrlShortenerOptions
|
||||
{
|
||||
/**
|
||||
* @param array{schema: ?string, hostname: ?string} $domain
|
||||
* @param 'http'|'https' $schema
|
||||
*/
|
||||
public function __construct(
|
||||
public array $domain = ['schema' => null, 'hostname' => null],
|
||||
public string $defaultDomain = '',
|
||||
public string $schema = 'http',
|
||||
public int $defaultShortCodesLength = DEFAULT_SHORT_CODES_LENGTH,
|
||||
public bool $autoResolveTitles = false,
|
||||
public bool $appendExtraPath = false,
|
||||
@@ -37,10 +38,8 @@ final readonly class UrlShortenerOptions
|
||||
$mode = EnvVars::SHORT_URL_MODE->loadFromEnv();
|
||||
|
||||
return new self(
|
||||
domain: [
|
||||
'schema' => ((bool) EnvVars::IS_HTTPS_ENABLED->loadFromEnv()) ? 'https' : 'http',
|
||||
'hostname' => EnvVars::DEFAULT_DOMAIN->loadFromEnv(),
|
||||
],
|
||||
defaultDomain: EnvVars::DEFAULT_DOMAIN->loadFromEnv(),
|
||||
schema: ((bool) EnvVars::IS_HTTPS_ENABLED->loadFromEnv()) ? 'https' : 'http',
|
||||
defaultShortCodesLength: $shortCodesLength,
|
||||
autoResolveTitles: (bool) EnvVars::AUTO_RESOLVE_TITLES->loadFromEnv(),
|
||||
appendExtraPath: (bool) EnvVars::REDIRECT_APPEND_EXTRA_PATH->loadFromEnv(),
|
||||
@@ -54,9 +53,4 @@ final readonly class UrlShortenerOptions
|
||||
{
|
||||
return $this->mode === ShortUrlMode::LOOSE;
|
||||
}
|
||||
|
||||
public function defaultDomain(): string
|
||||
{
|
||||
return $this->domain['hostname'] ?? '';
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user