The Dockerfile has been updated to use a new Redis module, techio.dev/lttech/caddy-redis. The go.mod file no longer requires github.com/go-redis/redis/v8 v8.11.5 as a dependency.
This commit updates the Redis dependency to v1.6.2 in Dockerfile and replaces the old Redis client library with a new one (v8) in envredisloader.go file. The new client is used to parse the REDIS_URL environment variable and retrieve configuration data from Redis server using Get() method instead of ParseURL().
The Dockerfile has been refactored to include new dependencies and remove unused ones. The redis.go file has been renamed to envredisloader.go for clarity.
This commit adds a new file `redis.go` which contains the implementation of a Redis loader for Caddy configs. The `ENVRedisLoader` struct can load Caddy configs over HTTP(S) and adapt the config based on the Content-Type header of the HTTP response. It uses the `go-redis/redis` package to connect to Redis and retrieve the config data.
This commit removes the locking functionality from RedisStorage by removing the redislock package and related code. The Lock and Unlock methods have been updated to use Redis' built-in SETNX and DEL commands respectively. The obtainLock, keepRedisLockFresh, and updateRedisLockFreshness functions have been removed as they are no longer needed.
This commit adds Redis lock support to the storage module. It uses the `github.com/bsm/redislock` package to obtain and release locks on keys in Redis. The implementation includes a background goroutine that refreshes the locks periodically, and a sync.Map to keep track of active locks.
The RedisStorage Lock method was refactored to use the lockKey function instead of the prefixKey function. This change ensures that the correct key is used when checking if a key is locked in Redis.
The RedisStorage Lock method now checks if the key is already locked before setting a new lock. The Unlock method now uses the new lock key to delete the lock.
This commit refactors the RedisStorage struct to prefix keys with a new method, `prefixKey`, instead of using separate methods for locking and unlocking. The `lockKey` method has been removed as it is no longer needed. Additionally, the `Exists` method now uses the `prefixKey` method to check if a key exists in Redis.
This commit refactors the RedisStorage struct to use a RedisClient instance instead of the global rdb variable. The Provision method now sets the RedisClient field of the struct, and all other methods that interact with Redis now use this field. Additionally, this commit adds a caddy.Provisioner implementation to the RedisStorage struct by implementing its Provision method.
- Update Redis version to v1.3.3
- Refactor RedisStorage struct to remove unused field and use a global variable for redis client instead of creating a new one on each method call
The Dockerfile has been updated to use the latest version of the caddy-redis module. The RedisStorage function in redis.go has been modified to handle errors correctly when parsing the REDIS_URL environment variable. The Provision function has also been removed as it is no longer needed.
This commit updates the Redis library used in the code from go-redis/v9 to redis/go-redis/v9. It also updates the version of caddy-redis/adapt and caddy-redis/storage in the Dockerfile. Additionally, this commit adds a context parameter to all Redis functions that did not have it before.