Pārlūkot izejas kodu

Created script to update config options

Alejandro Celaya 3 gadi atpakaļ
vecāks
revīzija
b2658073b3
3 mainītis faili ar 29 papildinājumiem un 4 dzēšanām
  1. 11 0
      README.md
  2. 14 0
      bin/set-option
  3. 4 4
      composer.json

+ 11 - 0
README.md

@@ -22,6 +22,7 @@ A PHP-based self-hosted URL shortener that can be used to serve shortened URLs u
     - [Serve](#serve)
     - [Bonus](#bonus)
 - [Update to new version](#update-to-new-version)
+    - [Update a configuration option](#update-a-configuration-option)
 - [Using a docker image](#using-a-docker-image)
 - [Using shlink](#using-shlink)
     - [Shlink CLI Help](#shlink-cli-help)
@@ -225,6 +226,16 @@ The `bin/update` will use the location from previous shlink version to import th
 
 **Important!** It is recommended that you don't skip any version when using this process. The update tool gets better on every version, but older versions might make assumptions.
 
+### Update a configuration option
+
+Sometimes you need to update the configuration on your shlink instance. Maybe you want to change the GeoLite2 license key, or move from http to https.
+
+In order to do that, run `bin/set-option` and follow the instructions. You will be asked to select the option to change, and then you will be asked to provide the new value.
+
+This script will take care of updating that value without changing anything else, and it will also delete the configuration cache so that the new value is applied.
+
+> This script will fail if you didn't run `bin/install` at least once.
+
 ## Using a docker image
 
 Starting with version 1.15.0, an official docker image is provided. You can learn how to use it by reading [the docs](docker/README.md).

+ 14 - 0
bin/set-option

@@ -0,0 +1,14 @@
+#!/usr/bin/env php
+<?php
+declare(strict_types=1);
+
+namespace Shlinkio\Shlink;
+
+use Shlinkio\Shlink\Installer\Command\SetOptionCommand;
+
+use function chdir;
+use function dirname;
+
+chdir(dirname(__DIR__));
+[,, $installer] = require __DIR__ . '/../vendor/shlinkio/shlink-installer/bin/run.php';
+$installer(SetOptionCommand::NAME);

+ 4 - 4
composer.json

@@ -15,7 +15,7 @@
         "php": "^7.4",
         "ext-json": "*",
         "ext-pdo": "*",
-        "akrabat/ip-address-middleware": "^1.0",
+        "akrabat/ip-address-middleware": "^2.0",
         "cakephp/chronos": "^2.0",
         "cocur/slugify": "^4.0",
         "doctrine/cache": "^1.9",
@@ -43,15 +43,15 @@
         "monolog/monolog": "^2.0",
         "nikolaposa/monolog-factory": "^3.0",
         "ocramius/proxy-manager": "^2.7.0",
-        "php-middleware/request-id": "^4.0",
+        "php-middleware/request-id": "^4.1",
         "predis/predis": "^1.1",
         "pugx/shortid-php": "^0.7",
         "ramsey/uuid": "^3.9",
-        "shlinkio/shlink-common": "^3.3.2",
+        "shlinkio/shlink-common": "dev-main#2963395 as 3.4",
         "shlinkio/shlink-config": "^1.0",
         "shlinkio/shlink-event-dispatcher": "^1.6",
         "shlinkio/shlink-importer": "^2.1",
-        "shlinkio/shlink-installer": "^5.2.0",
+        "shlinkio/shlink-installer": "^5.3",
         "shlinkio/shlink-ip-geolocation": "^1.5",
         "symfony/console": "^5.1",
         "symfony/filesystem": "^5.1",