Allow customization of Redis env vars for advanced configurations.

This commit is contained in:
Buster "Silver Eagle" Neece 2021-01-05 05:02:00 -06:00
parent 0e6910ba17
commit 991465d14c
No known key found for this signature in database
GPG Key ID: 6D9E12FF03411F4E
3 changed files with 30 additions and 4 deletions

View File

@ -34,7 +34,6 @@ release channel, you can take advantage of these new features and fixes.
"unprocessable" if their modified time updates (i.e. the file is reuploaded) or approximately a week passes.
- In preparation for the PHP 8.0 update and for other technical reasons, we have made some library changes:
- Switched PSR-6/PSR-16 cache implementation to the `symfony/cache` component.
- Removed the `studio24/rotate` and replaced with custom implementation for Flysystem.
- Switched from custom paginator to the `pagerfanta` library.
@ -46,6 +45,12 @@ release channel, you can take advantage of these new features and fixes.
- The Docker Utility Script (`./docker.sh`) will now ask before running `docker system prune` post-update.
- For more advanced setups, you can now set the following environment variables in `azuracast.env` to use a third-party
Redis service instead of the one bundled with AzuraCast:
- `REDIS_HOST` (default: `redis` for Docker, `localhost` for Ansible)
- `REDIS_PORT` (default: 6379)
- `REDIS_DB` for the database index (default: 1)
## Bug Fixes
- Hidden mount points and relays will still be shown on the profile page.

View File

@ -90,6 +90,25 @@ MYSQL_SLOW_QUERY_LOG=0
# Default: 100
MYSQL_MAX_CONNECTIONS=100
#
# Redis Configuration
#
# Uncomment these fields if you are using a third-party Redis host instead of the one provided with AzuraCast.
# Do not modify these fields if you are using the standard AzuraCast Redis host.
#
# Name of the Redis host.
# Default: redis
# REDIS_HOST=redis
# Port to connect to on the Redis host.
# Default: 6379
# REDIS_PORT=6379
# Database index to use on the Redis host.
# Default: 1
# REDIS_DB=1
#
# Advanced Configuration
#

View File

@ -146,11 +146,13 @@ return [
// Redis cache
Redis::class => function (Environment $environment) {
$redis_host = $environment->isDocker() ? 'redis' : 'localhost';
$redisHost = $_ENV['REDIS_HOST'] ?? ($environment->isDocker() ? 'redis' : 'localhost');
$redisPort = (int)($_ENV['REDIS_PORT'] ?? 6379);
$redisDb = (int)($_ENV['REDIS_DB'] ?? 1);
$redis = new Redis();
$redis->connect($redis_host, 6379, 15);
$redis->select(1);
$redis->connect($redisHost, $redisPort, 15);
$redis->select($redisDb);
return $redis;
},