Skip to content

Commit

Permalink
Merge pull request #66 from universityofadelaide/feature/optional-red…
Browse files Browse the repository at this point in the history
…is-authentication

Feature/optional redis authentication
  • Loading branch information
singularo authored Jun 17, 2019
2 parents 55bc569 + 680b7ef commit 6e214c1
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 2 deletions.
7 changes: 7 additions & 0 deletions docker-compose.linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ services:
PUBLIC_DIR: /shared/public
REDIS_ENABLED: 1
REDIS_HOST: redis
# REDIS_PASSWORD: testing
SHEPHERD_SITE_ID: 2
SHEPHERD_INSTALL_PROFILE: ua
SHEPHERD_SECRET_PATH: /code/private
Expand Down Expand Up @@ -65,6 +66,12 @@ services:

redis:
image: redis:alpine
command: |
redis-server
--maxmemory 512Mi
--maxmemory-policy allkeys-lru
--save ""
# --requirepass password
networks:
- default

Expand Down
9 changes: 8 additions & 1 deletion docker-compose.osx.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,10 @@ services:
environment:
HASH_SALT: random-hash
MEMCACHE_ENABLED: 0
PHP_IDE_CONFIG: serverName=localhost
PUBLIC_DIR: /shared/public
REDIS_ENABLED: 1
# REDIS_PASSWORD: testing
SHEPHERD_INSTALL_PROFILE: ua
SHEPHERD_SITE_ID: 2
SHEPHERD_SECRET_PATH: /code/private
Expand All @@ -32,7 +34,6 @@ services:
SITE_ADMIN_EMAIL: [email protected]
SITE_ADMIN_USERNAME: admin
SITE_ADMIN_PASSWORD: password
PHP_IDE_CONFIG: serverName=localhost
XDEBUG_CONFIG: "remote_host=docker.for.mac.localhost"
volumes:
- nfsmount:/code
Expand Down Expand Up @@ -60,6 +61,12 @@ services:

redis:
image: redis:alpine
command: |
redis-server
--maxmemory 512Mi
--maxmemory-policy allkeys-lru
--save ""
# --requirepass password
network_mode: service:web

memcached:
Expand Down
5 changes: 4 additions & 1 deletion src/Handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -177,9 +177,12 @@ public function generateSettings()
" \$settings['cache_prefix']['default'] = getenv('REDIS_PREFIX') ?: '';\n" .
" // If we're not installing, include the redis services.\n" .
" if (!isset(\$GLOBALS['install_state'])) {\n" .
" \$settings['cache']['default'] = 'cache.backend.redis';\n\n" .
" \$settings['cache']['default'] = 'cache.backend.redis';\n" .
" \$settings['container_yamls'][] = 'modules/contrib/redis/example.services.yml';\n" .
" }\n" .
" if (getenv('REDIS_PASSWORD_FILE') || getenv('REDIS_PASSWORD')) {\n" .
" \$settings['redis.connection']['password'] = getenv('REDIS_PASSWORD_FILE') ? file_get_contents(getenv('REDIS_PASSWORD_FILE')) : getenv('REDIS_PASSWORD');\n" .
" }\n" .
"}\n" .
"if (getenv('MEMCACHE_ENABLED')) {\n" .
" \$settings['memcache']['servers'] = [getenv('MEMCACHE_HOST') . ':11211' => 'default'] ?: ['127.0.0.1:11211' => 'default'];\n" .
Expand Down

0 comments on commit 6e214c1

Please sign in to comment.