From 576083ba1eff8ecec78263715a448751d40864e4 Mon Sep 17 00:00:00 2001 From: jon r Date: Wed, 26 Feb 2025 00:26:19 +0100 Subject: [PATCH] chore(api/settings): remove depreciated IS_DOCKER_SETUP variable This configuration was for a very old Docker version that still supported linking containers together, which allowed for service discovery via the environment. This is not present in Docker anymore for many years now, so removing. --- api/config/settings/common.py | 44 ++++------------------------------- 1 file changed, 4 insertions(+), 40 deletions(-) diff --git a/api/config/settings/common.py b/api/config/settings/common.py index e3765ed67..634e74235 100644 --- a/api/config/settings/common.py +++ b/api/config/settings/common.py @@ -1,6 +1,5 @@ import logging.config import sys -import warnings from collections import OrderedDict from urllib.parse import urlparse, urlsplit @@ -36,8 +35,6 @@ Available levels: """ -IS_DOCKER_SETUP = env.bool("IS_DOCKER_SETUP", False) - # allows makemigrations and superuser creation FORCE = env.bool("FORCE", False) @@ -395,31 +392,6 @@ vars().update(EMAIL_CONFIG) # ------------------------------------------------------------------------------ # See: https://docs.djangoproject.com/en/dev/ref/settings/#databases -# The `_database_url_docker` variable will only by used as default for DATABASE_URL -# in the context of a docker deployment. -_database_url_docker = None -if IS_DOCKER_SETUP and env.str("DATABASE_URL", None) is None: - warnings.warn( - DeprecationWarning( - "the automatically generated 'DATABASE_URL' configuration in the docker " - "setup is deprecated, please configure either the 'DATABASE_URL' " - "environment variable or the 'DATABASE_HOST', 'DATABASE_USER' and " - "'DATABASE_PASSWORD' environment variables instead" - ) - ) - _DOCKER_DATABASE_HOST = "postgres" - _DOCKER_DATABASE_PORT = 5432 - _DOCKER_DATABASE_USER = env.str("POSTGRES_ENV_POSTGRES_USER", "postgres") - _DOCKER_DATABASE_PASSWORD = env.str("POSTGRES_ENV_POSTGRES_PASSWORD", "") - _DOCKER_DATABASE_NAME = _DOCKER_DATABASE_USER - - _database_url_docker = ( - f"postgres:" - f"//{_DOCKER_DATABASE_USER}:{_DOCKER_DATABASE_PASSWORD}" - f"@{_DOCKER_DATABASE_HOST}:{_DOCKER_DATABASE_PORT}" - f"/{_DOCKER_DATABASE_NAME}" - ) - DATABASE_HOST = env.str("DATABASE_HOST", "localhost") """ The hostname of the PostgreSQL server. Defaults to ``localhost``. @@ -442,8 +414,7 @@ The name of the PostgreSQL database. Defaults to ``funkwhale``. """ DATABASE_URL = env.db( "DATABASE_URL", - _database_url_docker # This is only set in the context of a docker deployment. - or ( + ( f"postgres:" f"//{DATABASE_USER}:{DATABASE_PASSWORD}" f"@{DATABASE_HOST}:{DATABASE_PORT}" @@ -840,11 +811,7 @@ if AUTH_LDAP_ENABLED: # SLUGLIFIER AUTOSLUG_SLUGIFY_FUNCTION = "slugify.slugify" -CACHE_URL_DEFAULT = "redis://127.0.0.1:6379/0" -if IS_DOCKER_SETUP: - CACHE_URL_DEFAULT = "redis://redis:6379/0" - -CACHE_URL = env.str("CACHE_URL", default=CACHE_URL_DEFAULT) +CACHE_URL = env.str("CACHE_URL", default="redis://127.0.0.1:6379/0") """ The URL of your redis server. For example: @@ -1529,10 +1496,7 @@ TYPESENSE_PROTOCOL = env("TYPESENSE_PROTOCOL", default="http") """Typesense listening protocol""" TYPESENSE_HOST = env( "TYPESENSE_HOST", - default="typesense" if IS_DOCKER_SETUP else "localhost", + default="localhost", ) -""" -Typesense hostname. Defaults to `localhost` on non-Docker deployments and to `typesense` on -Docker deployments. -""" +"""Typesense hostname. Defaults to `localhost`.""" TYPESENSE_NUM_TYPO = env("TYPESENSE_NUM_TYPO", default=5)