Skip to content

Commit

Permalink
Merge pull request #1 from digorgonzola/allow_cidr_nets
Browse files Browse the repository at this point in the history
allowed_hosts: support CIDR notation
  • Loading branch information
digorgonzola authored Nov 16, 2023
2 parents 10c4db4 + 3f76332 commit 7209f1c
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
- published

env:
AWS_REGION: ap-northeast-1
AWS_REGION: ap-southeast-2
TAG: ${{ github.event.release.tag_name }}

permissions:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
- "main"

env:
AWS_REGION: ap-northeast-1
AWS_REGION: ap-southeast-2
TAG_PREFIX: test

permissions:
Expand Down
8 changes: 8 additions & 0 deletions app/app/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,13 @@
)
)

ALLOWED_CIDR_NETS = []
ALLOWED_CIDR_NETS.extend(
filter(
None,
os.environ.get('ALLOWED_CIDR_NETS', '').split(',')
)
)

# Application definition

Expand All @@ -51,6 +58,7 @@
]

MIDDLEWARE = [
'allow_cidr.middleware.AllowCIDRMiddleware',
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
Expand Down
3 changes: 2 additions & 1 deletion docker-compose-proxy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ services:
- DB_NAME=app
- DB_USER=postgres
- DB_PASS=supersecretpassword
- ALLOWED_HOSTS=127.0.0.1,localhost
- ALLOWED_HOSTS=*
- ALLOWED_CIDR_NETS=127.0.0.0/8
depends_on:
- db

Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
Django>=2.1.3,<2.2.0
djangorestframework>=3.9.0,<3.10.0
django-allow-cidr>=0.3.1,<0.4.0
psycopg2>=2.7.5,<2.8.0
Pillow>=5.3.0,<5.4.0
uwsgi>=2.0.18,<2.1.0
Expand Down

0 comments on commit 7209f1c

Please sign in to comment.