From af8b6b7f9646c8866da3fad39289a316daa92eac Mon Sep 17 00:00:00 2001 From: Alejandro Celaya Date: Wed, 29 Apr 2020 19:24:18 +0200 Subject: [PATCH 1/6] Documented how to pass a GEOLITE license key --- composer.json | 2 +- docker/README.md | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index cd0d699a..e6c59e98 100644 --- a/composer.json +++ b/composer.json @@ -52,7 +52,7 @@ "shlinkio/shlink-common": "^3.0", "shlinkio/shlink-config": "^1.0", "shlinkio/shlink-event-dispatcher": "^1.4", - "shlinkio/shlink-installer": "^4.3.2", + "shlinkio/shlink-installer": "^4.4.0", "shlinkio/shlink-ip-geolocation": "^1.4", "symfony/console": "^5.0", "symfony/filesystem": "^5.0", diff --git a/docker/README.md b/docker/README.md index 3977fa37..b19c0335 100644 --- a/docker/README.md +++ b/docker/README.md @@ -121,6 +121,8 @@ This is the complete list of supported env vars: In the future, these redis servers could be used for other caching operations performed by shlink. +* `GEOLITE_LICENSE_KEY`: The license key used to download new GeoLite2 database files. This is not mandatory, as a default license key is provided, but it is **strongly recommended** that you provide your own. Go to [https://shlink.io/documentation/geolite-license-key](https://shlink.io/documentation/geolite-license-key) to know how to generate it. + An example using all env vars could look like this: ```bash @@ -147,6 +149,7 @@ docker run \ -e TASK_WORKER_NUM=32 \ -e "VISITS_WEBHOOKS=http://my-api.com/api/v2.3/notify,https://third-party.io/foo" \ -e DEFAULT_SHORT_CODES_LENGTH=6 \ + -e GEOLITE_LICENSE_KEY=kjh23ljkbndskj345 \ shlinkio/shlink:stable ``` @@ -187,7 +190,8 @@ The whole configuration should have this format, but it can be split into multip "password": "123abc", "host": "something.rds.amazonaws.com", "port": "3306" - } + }, + "geolite_license_key": "kjh23ljkbndskj345" } ``` From 9190996e544d52aa9618c47d1edaa05ca91b5afd Mon Sep 17 00:00:00 2001 From: Alejandro Celaya Date: Wed, 29 Apr 2020 19:26:34 +0200 Subject: [PATCH 2/6] Added support for geolite_license_key config option --- module/Core/src/Config/SimplifiedConfigParser.php | 1 + module/Core/test/Config/SimplifiedConfigParserTest.php | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/module/Core/src/Config/SimplifiedConfigParser.php b/module/Core/src/Config/SimplifiedConfigParser.php index ee29d195..edfe1b79 100644 --- a/module/Core/src/Config/SimplifiedConfigParser.php +++ b/module/Core/src/Config/SimplifiedConfigParser.php @@ -33,6 +33,7 @@ class SimplifiedConfigParser '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'], + 'geolite_license_key' => ['geolite2', 'license_key'], ]; private const SIMPLIFIED_CONFIG_SIDE_EFFECTS = [ 'delete_short_url_threshold' => [ diff --git a/module/Core/test/Config/SimplifiedConfigParserTest.php b/module/Core/test/Config/SimplifiedConfigParserTest.php index 02f96423..268731db 100644 --- a/module/Core/test/Config/SimplifiedConfigParserTest.php +++ b/module/Core/test/Config/SimplifiedConfigParserTest.php @@ -60,6 +60,7 @@ class SimplifiedConfigParserTest extends TestCase 'https://third-party.io/foo', ], 'default_short_codes_length' => 8, + 'geolite_license_key' => 'kjh23ljkbndskj345', ]; $expected = [ 'app_options' => [ @@ -127,6 +128,10 @@ class SimplifiedConfigParserTest extends TestCase ], ], ], + + 'geolite2' => [ + 'license_key' => 'kjh23ljkbndskj345', + ], ]; $result = ($this->postProcessor)(array_merge($config, $simplified)); From f71bb5e307863b975812da6875c5405641737c41 Mon Sep 17 00:00:00 2001 From: Alejandro Celaya Date: Wed, 29 Apr 2020 19:27:35 +0200 Subject: [PATCH 3/6] Added support for GEOLITE_LICENSE_KEY env var for docker image --- docker/config/shlink_in_docker.local.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docker/config/shlink_in_docker.local.php b/docker/config/shlink_in_docker.local.php index 6cf86434..a20d1100 100644 --- a/docker/config/shlink_in_docker.local.php +++ b/docker/config/shlink_in_docker.local.php @@ -147,4 +147,8 @@ return [ ], ], + 'geolite2' => [ + 'license_key' => env('GEOLITE_LICENSE_KEY', 'G4Lm0C60yJsnkdPi'), + ], + ]; From a1c74c4038fcd66ee1003c0097c444f9e730bd51 Mon Sep 17 00:00:00 2001 From: Alejandro Celaya Date: Wed, 29 Apr 2020 19:31:10 +0200 Subject: [PATCH 4/6] Updated changelog --- CHANGELOG.md | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index af2297d4..9bb6d03b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,29 @@ 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). +## 2.1.4 - 2020-04-30 + +#### Added + +* *Nothing* + +#### Changed + +* *Nothing* + +#### Deprecated + +* *Nothing* + +#### Removed + +* *Nothing* + +#### Fixed + +* [#742](https://github.com/shlinkio/shlink/issues/742) Allowed a custom GeoLite2 license key to be provided, in order to avoid download limits. + + ## 2.1.3 - 2020-04-09 #### Added From 4d4423413d8d5fdc978e3e887a7b56b660228116 Mon Sep 17 00:00:00 2001 From: Alejandro Celaya Date: Wed, 29 Apr 2020 19:44:08 +0200 Subject: [PATCH 5/6] Added GEOLITE_LICENSE_KEY env var to basic docker example, to encourage using it --- docker/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/README.md b/docker/README.md index b19c0335..1e565bb7 100644 --- a/docker/README.md +++ b/docker/README.md @@ -18,7 +18,7 @@ It also expects these two env vars to be provided, in order to properly generate So based on this, to run shlink on a local docker service, you should run a command like this: ```bash -docker run --name shlink -p 8080:8080 -e SHORT_DOMAIN_HOST=doma.in -e SHORT_DOMAIN_SCHEMA=https shlinkio/shlink:stable +docker run --name shlink -p 8080:8080 -e SHORT_DOMAIN_HOST=doma.in -e SHORT_DOMAIN_SCHEMA=https -e GEOLITE_LICENSE_KEY=kjh23ljkbndskj345 shlinkio/shlink:stable ``` ### Interact with shlink's CLI on a running container. From 93a2c83652905563447fa09e4a5929b3b7351657 Mon Sep 17 00:00:00 2001 From: Alejandro Celaya Date: Wed, 29 Apr 2020 20:31:06 +0200 Subject: [PATCH 6/6] Enabled GeoLite installer config option --- config/autoload/installer.global.php | 1 + 1 file changed, 1 insertion(+) diff --git a/config/autoload/installer.global.php b/config/autoload/installer.global.php index c40d75d1..7d44744c 100644 --- a/config/autoload/installer.global.php +++ b/config/autoload/installer.global.php @@ -31,6 +31,7 @@ return [ Option\WebWorkerNumConfigOption::class, Option\RedisServersConfigOption::class, Option\ShortCodeLengthOption::class, + Option\GeoLiteLicenseKeyConfigOption::class, ], 'installation_commands' => [