Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
feat: Implement configurable ALLOWED_HOSTS
This commit enhances security by replacing the wildcard `ALLOWED_HOSTS` setting with a configurable list loaded from the `DJANGO_ALLOWED_HOSTS` environment variable.

- The `promo_code/settings.py` file now parses a comma-separated string from the environment variable.
- The `.env.example` file has been updated to include `DJANGO_ALLOWED_HOSTS` with a default value of `localhost,127.0.0.1,0.0.0.0`.
  • Loading branch information
RandomProgramm3r committed Jul 26, 2025
commit 09e4e4df8399f0d7d3754f4691bef0bf3097ebbc
1 change: 1 addition & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ ANTIFRAUD_INTERNAL_PORT=9090

DJANGO_DEBUG=False
DJANGO_SECRET_KEY=your_django_secret_key
DJANGO_ALLOWED_HOSTS=localhost,127.0.0.1,0.0.0.0

POSTGRES_DATABASE=your_postgres_database_name
POSTGRES_HOST=db
Expand Down
2 changes: 1 addition & 1 deletion promo_code/promo_code/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def load_bool(name, default):

DEBUG = load_bool('DJANGO_DEBUG', False)

ALLOWED_HOSTS = ['*']
ALLOWED_HOSTS = os.getenv('DJANGO_ALLOWED_HOSTS', '').split(',')

INSTALLED_APPS = [
'django.contrib.admin',
Expand Down