Skip to content

feat(*): support for Redis password #23

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 2, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions install.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,22 @@ post_install_actions:
if ( {{ contains "ddev-router" (list .DdevGlobalConfig.omit_containers | toString) }} ); then
printf "#ddev-generated\nservices:\n redis-commander:\n ports:\n - 1358:1358\n" > docker-compose.redis-commander_norouter.yaml
fi
- |
#ddev-description:If Redis is optimized, set a password
if [ $(ddev dotenv get .ddev/.env.redis --redis-optimized 2>/dev/null) = "true" ]; then
printf "#ddev-generated\nservices:\n redis-commander:\n environment:\n - REDIS_PASSWORD=redis\n" > docker-compose.redis-commander_password.yaml
fi
- |
echo "You can now use 'ddev redis-commander' to launch Redis Commander UI"

removal_actions:
- |
#ddev-description:Remove docker-compose.redis-commander_password.yaml file
file=docker-compose.redis-commander_password.yaml
if [ -f "${file}" ]; then
if grep -q '#ddev-generated' "${file}"; then
rm -f "${file}"
else
echo "Unwilling to remove '$DDEV_APPROOT/.ddev/${file}' because it does not have #ddev-generated in it; you can manually delete it if it is safe to delete."
fi
fi
25 changes: 25 additions & 0 deletions tests/test.bats
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,17 @@ setup() {
# Redis add-on is required for Redis Commander
run ddev add-on get ddev/ddev-redis
assert_success

export HAS_OPTIMIZED_CONFIG=false
}

health_checks() {
if [ "$HAS_OPTIMIZED_CONFIG" = "true" ]; then
assert_file_exist .ddev/docker-compose.redis-commander_password.yaml
else
assert_file_not_exist .ddev/docker-compose.redis-commander_password.yaml
fi

run curl -sfI http://${PROJNAME}.ddev.site:1358
assert_success
assert_output --partial "HTTP/1.1 200"
Expand Down Expand Up @@ -81,6 +89,23 @@ teardown() {
health_checks
}

@test "install from directory with optimized Redis" {
set -eu -o pipefail

export HAS_OPTIMIZED_CONFIG=true

run ddev dotenv set .ddev/.env.redis --redis-optimized=true
assert_success
assert_file_exist .ddev/.env.redis

echo "# ddev add-on get ${DIR} with project ${PROJNAME} in $(pwd)" >&3
run ddev add-on get "${DIR}"
assert_success
run ddev restart -y
assert_success
health_checks
}

# bats test_tags=release
@test "install from release" {
set -eu -o pipefail
Expand Down