2019-08-16 19:38:26 +03:00
|
|
|
#!/usr/bin/env sh
|
|
|
|
set -e
|
|
|
|
|
|
|
|
cd /etc/shlink
|
|
|
|
|
2024-01-03 21:22:33 +03:00
|
|
|
# Create data directories if they do not exist. This allows data dir to be mounted as an empty dir if needed
|
|
|
|
mkdir -p data/cache data/locks data/log data/proxies
|
|
|
|
|
2023-07-05 10:58:51 +03:00
|
|
|
flags="--no-interaction --clear-db-cache"
|
2019-08-16 19:38:26 +03:00
|
|
|
|
2023-05-21 15:30:20 +03:00
|
|
|
# Skip downloading GeoLite2 db file if the license key env var was not defined or skipping was explicitly set
|
2023-07-05 10:58:51 +03:00
|
|
|
if [ -z "${GEOLITE_LICENSE_KEY}" ] || [ "${SKIP_INITIAL_GEOLITE_DOWNLOAD}" = "true" ]; then
|
2023-05-21 15:30:20 +03:00
|
|
|
flags="${flags} --skip-download-geolite"
|
2021-04-08 15:32:19 +03:00
|
|
|
fi
|
|
|
|
|
2023-09-21 10:29:59 +03:00
|
|
|
# If INITIAL_API_KEY was provided, create an initial API key
|
|
|
|
if [ -n "${INITIAL_API_KEY}" ]; then
|
2023-09-22 11:00:19 +03:00
|
|
|
flags="${flags} --initial-api-key=${INITIAL_API_KEY}"
|
2023-09-21 10:29:59 +03:00
|
|
|
fi
|
2023-09-21 09:58:05 +03:00
|
|
|
|
2023-05-21 15:30:20 +03:00
|
|
|
php vendor/bin/shlink-installer init ${flags}
|
|
|
|
|
2024-02-12 22:29:40 +03:00
|
|
|
if [ "$SHLINK_RUNTIME" = 'rr' ]; then
|
2022-08-27 14:01:38 +03:00
|
|
|
./bin/rr serve -c config/roadrunner/.rr.yml
|
|
|
|
fi
|