Merge pull request #1186 from acelaya-forks/feature/deprecate-domain-env-vars

Feature/deprecate domain env vars
This commit is contained in:
Alejandro Celaya 2021-09-26 09:23:01 +02:00 committed by GitHub
commit ce7296eebb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 7 deletions

View file

@ -15,7 +15,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com), and this
* [#1157](https://github.com/shlinkio/shlink/issues/1157) All routes now support CORS, not only rest ones. * [#1157](https://github.com/shlinkio/shlink/issues/1157) All routes now support CORS, not only rest ones.
### Deprecated ### Deprecated
* *Nothing* * [#1164](https://github.com/shlinkio/shlink/issues/1164) Deprecated `SHORT_DOMAIN_HOST` and `SHORT_DOMAIN_SCHEMA` env vars. Use `DEFAULT_DOMAIN` and `USE_HTTPS=true|false` instead.
### Removed ### Removed
* *Nothing* * *Nothing*

View file

@ -13,13 +13,15 @@ return (static function (): array {
$webhooks = env('VISITS_WEBHOOKS'); $webhooks = env('VISITS_WEBHOOKS');
$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
return [ return [
'url_shortener' => [ 'url_shortener' => [
'domain' => [ 'domain' => [
'schema' => env('SHORT_DOMAIN_SCHEMA', 'http'), // Deprecated SHORT_DOMAIN_* env vars
'hostname' => env('SHORT_DOMAIN_HOST', ''), 'schema' => $useHttps !== null ? (bool) $useHttps : env('SHORT_DOMAIN_SCHEMA', 'http'),
'hostname' => env('DEFAULT_DOMAIN', env('SHORT_DOMAIN_HOST', '')),
], ],
'validate_url' => (bool) env('VALIDATE_URLS', false), // Deprecated 'validate_url' => (bool) env('VALIDATE_URLS', false), // Deprecated
'visits_webhooks' => $webhooks === null ? [] : explode(',', $webhooks), 'visits_webhooks' => $webhooks === null ? [] : explode(',', $webhooks),

View file

@ -11,8 +11,8 @@ It exposes a shlink instance served with [swoole](https://www.swoole.co.uk/), wh
The most basic way to run Shlink's docker image is by providing these mandatory env vars. The most basic way to run Shlink's docker image is by providing these mandatory env vars.
* `SHORT_DOMAIN_HOST`: The custom short domain used for this shlink instance. For example **doma.in**. * `DEFAULT_DOMAIN`: The default short domain used for this shlink instance. For example **doma.in**.
* `SHORT_DOMAIN_SCHEMA`: Either **http** or **https**. * `USE_HTTPS`: Either **true** or **false**.
* `GEOLITE_LICENSE_KEY`: Your GeoLite2 license key. [Learn more](https://shlink.io/documentation/geolite-license-key/) about this. * `GEOLITE_LICENSE_KEY`: Your GeoLite2 license key. [Learn more](https://shlink.io/documentation/geolite-license-key/) about this.
To run shlink on top of a local docker service, and using an internal SQLite database, do the following: To run shlink on top of a local docker service, and using an internal SQLite database, do the following:
@ -21,8 +21,8 @@ To run shlink on top of a local docker service, and using an internal SQLite dat
docker run \ docker run \
--name shlink \ --name shlink \
-p 8080:8080 \ -p 8080:8080 \
-e SHORT_DOMAIN_HOST=doma.in \ -e DEFAULT_DOMAIN=doma.in \
-e SHORT_DOMAIN_SCHEMA=https \ -e USE_HTTPS=true \
-e GEOLITE_LICENSE_KEY=kjh23ljkbndskj345 \ -e GEOLITE_LICENSE_KEY=kjh23ljkbndskj345 \
shlinkio/shlink:stable shlinkio/shlink:stable
``` ```