fix(api): move docker cache settings to django settings

environments/review-docs-nginx-aqlin2/deployments/17397
jo 2023-04-08 18:49:22 +02:00
rodzic e4793f06e8
commit 83b2aa0ad8
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: B2FEC9B22722B984
3 zmienionych plików z 8 dodań i 7 usunięć

Wyświetl plik

@ -109,8 +109,6 @@ WORKDIR /app
RUN set -eux; \
pip3 install --no-deps --editable .
ENV CACHE_URL="redis://redis:6379/0"
ENV CELERY_BROKER_URL="redis://redis:6379/0"
ENV IS_DOCKER_SETUP=true
CMD ["./docker/server.sh"]

Wyświetl plik

@ -806,6 +806,9 @@ if AUTH_LDAP_ENABLED:
AUTOSLUG_SLUGIFY_FUNCTION = "slugify.slugify"
CACHE_DEFAULT = "redis://127.0.0.1:6379/0"
if IS_DOCKER_SETUP:
CACHE_DEFAULT = "redis://redis:6379/0"
CACHE_URL = env.cache_url("CACHE_URL", default=CACHE_DEFAULT)
"""
The URL of your redis server. For example:
@ -820,7 +823,8 @@ If you're using password auth (the extra slash is important)
.. note::
If you want to use Redis over unix sockets, you also need to update
:attr:`CELERY_BROKER_URL`
:attr:`CELERY_BROKER_URL`, because the scheme differ from the one used by
:attr:`CACHE_URL`.
"""
CACHES = {
@ -849,7 +853,7 @@ CACHEOPS_ENABLED = bool(CACHEOPS_DURATION)
if CACHEOPS_ENABLED:
INSTALLED_APPS += ("cacheops",)
CACHEOPS_REDIS = env("CACHE_URL", default=CACHE_DEFAULT)
CACHEOPS_REDIS = CACHE_URL
CACHEOPS_PREFIX = lambda _: "cacheops" # noqa
CACHEOPS_DEFAULTS = {"timeout": CACHEOPS_DURATION}
CACHEOPS = {
@ -860,9 +864,7 @@ if CACHEOPS_ENABLED:
# CELERY
INSTALLED_APPS += ("funkwhale_api.taskapp.celery.CeleryConfig",)
CELERY_BROKER_URL = env(
"CELERY_BROKER_URL", default=env("CACHE_URL", default=CACHE_DEFAULT)
)
CELERY_BROKER_URL = env.str("CELERY_BROKER_URL", default=CACHE_URL)
"""
The celery task broker URL. Defaults to :attr:`CACHE_URL`.
You don't need to tweak this unless you want

Wyświetl plik

@ -0,0 +1 @@
Move api docker hardcoded env vars in the settings module