Skip to content

Commit

Permalink
✨(edxapp) make memcached host & port configurable
Browse files Browse the repository at this point in the history
We introduce new configuration variables for the memcached cache
backend that would be now easily configurable via the environment or the
settings.yml file.
  • Loading branch information
jmaupetit committed Feb 8, 2019
1 parent bfcaa3c commit 9e32a36
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 4 additions & 1 deletion config/cms/docker_run_production.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,9 @@

LOG_DIR = config("LOG_DIR", default="/edx/var/logs/edx")

MEMCACHED_HOST = config("MEMCACHED_HOST", default="memcached")
MEMCACHED_PORT = config("MEMCACHED_PORT", default=11211, formatter=int)

CACHES = config(
"CACHES",
default={
Expand All @@ -152,7 +155,7 @@
},
"default": {
"BACKEND": "django.core.cache.backends.memcached.MemcachedCache",
"LOCATION": "memcached:11211",
"LOCATION": "{}:{}".format(MEMCACHED_HOST, MEMCACHED_PORT),
}
},
formatter=json.loads,
Expand Down
5 changes: 4 additions & 1 deletion config/lms/docker_run_production.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,9 @@
# being a str()
SESSION_COOKIE_NAME = str(config("SESSION_COOKIE_NAME"))

MEMCACHED_HOST = config("MEMCACHED_HOST", default="memcached")
MEMCACHED_PORT = config("MEMCACHED_PORT", default=11211, formatter=int)

CACHES = config(
"CACHES",
default={
Expand All @@ -219,7 +222,7 @@
},
"default": {
"BACKEND": "django.core.cache.backends.memcached.MemcachedCache",
"LOCATION": "memcached:11211",
"LOCATION": "{}:{}".format(MEMCACHED_HOST, MEMCACHED_PORT),
}
},
formatter=json.loads,
Expand Down

0 comments on commit 9e32a36

Please sign in to comment.