feat(common,compose): add optional FUNKWHALE_PORT for single-node development

This commit is contained in:
jon r 2024-08-27 11:46:39 +02:00
parent 51d5bbf52b
commit c375329580
3 changed files with 12 additions and 1 deletions

View File

@ -4,6 +4,7 @@ DJANGO_SECRET_KEY=dev
C_FORCE_ROOT=true
FUNKWHALE_HOSTNAME=localhost
FUNKWHALE_PROTOCOL=http
FUNKWHALE_PORT=8000
PYTHONDONTWRITEBYTECODE=true
VUE_PORT=8080
MUSIC_DIRECTORY_PATH=/music

View File

@ -224,7 +224,15 @@ ALLOWED_HOSTS = env.list("DJANGO_ALLOWED_HOSTS", default=[]) + [FUNKWHALE_HOSTNA
List of allowed hostnames for which the Funkwhale server will answer.
"""
CSRF_TRUSTED_ORIGINS = [urlparse(o, FUNKWHALE_PROTOCOL).geturl() for o in ALLOWED_HOSTS]
try:
FUNKWHALE_PORT = env.int("FUNKWHALE_PORT")
except:
logger.warning("Funkwhale is served from default port.")
try:
CSRF_TRUSTED_ORIGINS = [urlparse('//' + o + (':' + str(FUNKWHALE_PORT) if (FUNKWHALE_PORT != 80) else ''), FUNKWHALE_PROTOCOL).geturl() for o in ALLOWED_HOSTS]
except:
CSRF_TRUSTED_ORIGINS = [urlparse('//' + o, FUNKWHALE_PROTOCOL).geturl() for o in ALLOWED_HOSTS]
"""
List of origins that are trusted for unsafe requests
We simply consider all allowed hosts to be trusted origins

View File

@ -79,6 +79,7 @@ services:
- "DATABASE_URL=postgresql://postgres@postgres/postgres"
- "CACHE_URL=redis://redis:6379/0"
- "STATIC_ROOT=/staticfiles"
# - FUNKWHALE_PORT=${FUNKWHALE_PORT}
depends_on:
- postgres
@ -110,6 +111,7 @@ services:
- "FUNKWHALE_PROTOCOL=${FUNKWHALE_PROTOCOL:-http}"
- "DATABASE_URL=postgresql://postgres@postgres/postgres"
- "CACHE_URL=redis://redis:6379/0"
# - FUNKWHALE_PORT=${FUNKWHALE_PORT}
volumes:
- ./api:/app
- "${MUSIC_DIRECTORY_SERVE_PATH:-./data/music}:/music:ro"