mirror of
https://github.com/shlinkio/shlink.git
synced 2025-02-25 18:45:27 -06:00
Merge pull request #1202 from acelaya-forks/feature/fix-use-https
Fixed crash when trying to resolve schema based on USE_HTTPS env var
This commit is contained in:
commit
c3aa2df4e9
17
CHANGELOG.md
17
CHANGELOG.md
@ -4,6 +4,23 @@ All notable changes to this project will be documented in this file.
|
|||||||
|
|
||||||
The format is based on [Keep a Changelog](https://keepachangelog.com), and this project adheres to [Semantic Versioning](https://semver.org).
|
The format is based on [Keep a Changelog](https://keepachangelog.com), and this project adheres to [Semantic Versioning](https://semver.org).
|
||||||
|
|
||||||
|
## [2.9.1] - 2021-10-11
|
||||||
|
### Added
|
||||||
|
* *Nothing*
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
* *Nothing*
|
||||||
|
|
||||||
|
### Deprecated
|
||||||
|
* *Nothing*
|
||||||
|
|
||||||
|
### Removed
|
||||||
|
* *Nothing*
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
* [#1201](https://github.com/shlinkio/shlink/issues/1201) Fixed crash when using the new `USE_HTTPS`, as it's boolean raw value was being used instead of resolving "https" or "http".
|
||||||
|
|
||||||
|
|
||||||
## [2.9.0] - 2021-10-10
|
## [2.9.0] - 2021-10-10
|
||||||
### Added
|
### Added
|
||||||
* [#1015](https://github.com/shlinkio/shlink/issues/1015) Shlink now accepts configuration via env vars even when not using docker.
|
* [#1015](https://github.com/shlinkio/shlink/issues/1015) Shlink now accepts configuration via env vars even when not using docker.
|
||||||
|
@ -10,14 +10,22 @@ use const Shlinkio\Shlink\MIN_SHORT_CODES_LENGTH;
|
|||||||
return (static function (): array {
|
return (static function (): array {
|
||||||
$shortCodesLength = (int) env('DEFAULT_SHORT_CODES_LENGTH', DEFAULT_SHORT_CODES_LENGTH);
|
$shortCodesLength = (int) env('DEFAULT_SHORT_CODES_LENGTH', DEFAULT_SHORT_CODES_LENGTH);
|
||||||
$shortCodesLength = $shortCodesLength < MIN_SHORT_CODES_LENGTH ? MIN_SHORT_CODES_LENGTH : $shortCodesLength;
|
$shortCodesLength = $shortCodesLength < MIN_SHORT_CODES_LENGTH ? MIN_SHORT_CODES_LENGTH : $shortCodesLength;
|
||||||
$useHttps = env('USE_HTTPS'); // Deprecated. For v3, set this to true by default, instead of null
|
$resolveSchema = static function (): string {
|
||||||
|
$useHttps = env('USE_HTTPS'); // Deprecated. For v3, set this to true by default, instead of null
|
||||||
|
if ($useHttps !== null) {
|
||||||
|
$boolUseHttps = (bool) $useHttps;
|
||||||
|
return $boolUseHttps ? 'https' : 'http';
|
||||||
|
}
|
||||||
|
|
||||||
|
return env('SHORT_DOMAIN_SCHEMA', 'http');
|
||||||
|
};
|
||||||
|
|
||||||
return [
|
return [
|
||||||
|
|
||||||
'url_shortener' => [
|
'url_shortener' => [
|
||||||
'domain' => [
|
'domain' => [
|
||||||
// Deprecated SHORT_DOMAIN_* env vars
|
// Deprecated SHORT_DOMAIN_* env vars
|
||||||
'schema' => $useHttps !== null ? (bool) $useHttps : env('SHORT_DOMAIN_SCHEMA', 'http'),
|
'schema' => $resolveSchema(),
|
||||||
'hostname' => env('DEFAULT_DOMAIN', env('SHORT_DOMAIN_HOST', '')),
|
'hostname' => env('DEFAULT_DOMAIN', env('SHORT_DOMAIN_HOST', '')),
|
||||||
],
|
],
|
||||||
'validate_url' => (bool) env('VALIDATE_URLS', false), // Deprecated
|
'validate_url' => (bool) env('VALIDATE_URLS', false), // Deprecated
|
||||||
|
Loading…
Reference in New Issue
Block a user