umap/umap/tests/settings.py
Alexis Métaireau 940ae77602 settings: Make the websocket settings clearer.
It is now using `WEBSOCKET_BACK_HOST`, `WEBSOCKET_BACK_PORT` and
`WEBSOCKET_FRONT_URI`.

We need to take in consideration that the "front" WebSocket address
(that clients will connect to) might be different than the "back" ip and
port which are bound in the host.

This happens for instance for reverse proxies, or when running inside
a container.

We considered using a `WEBSOCKET_TLS` setting, to try guessing the
"front" address based on `WEBSOCKET_HOST`, `WEBSOCKET_PORT` and
`WEBSOCKET_TLS`, but as the back and front address can differ, this
would need to introduce a `WEBSOCKET_URI` in any case, so we went with
just using it, and not adding an extra `WEBSOCKET_TLS`.
2024-06-07 18:21:30 +02:00

31 lines
816 B
Python

import os
from umap.settings.base import * # pylint: disable=W0614,W0401
SECRET_KEY = "justfortests"
DEFAULT_FROM_EMAIL = "test@test.org"
EMAIL_BACKEND = "django.core.mail.backends.locmem.EmailBackend"
STORAGES["staticfiles"]["BACKEND"] = (
"django.contrib.staticfiles.storage.StaticFilesStorage"
)
if os.environ.get("GITHUB_ACTIONS", False) == "true":
DATABASES = {
"default": {
"ENGINE": "django.contrib.gis.db.backends.postgis",
"NAME": "postgres",
"USER": "postgres",
"HOST": "localhost",
"PORT": 5432,
"PASSWORD": "postgres",
}
}
PASSWORD_HASHERS = [
"django.contrib.auth.hashers.MD5PasswordHasher",
]
WEBSOCKET_ENABLED = True
WEBSOCKET_BACK_PORT = "8010"
WEBSOCKET_FRONT_URI = "ws://localhost:8010"