Skip to content

Commit 97edf6c

Browse files
committed
CSRF_TRUSTED_ORIGINS for Django settings is read from environment variable.
1 parent 84c0f58 commit 97edf6c

File tree

7 files changed

+18
-5
lines changed

7 files changed

+18
-5
lines changed

docker/docker-compose.eea.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ services:
1212
networks:
1313
- qc_tool_network
1414
frontend:
15-
image: eeacms/copernicus-qctool-frontend:2.3.3
15+
image: eeacms/copernicus-qctool-frontend:2.3.4rc1
1616
ports:
1717
- 8000:8000
1818
environment:
@@ -35,6 +35,8 @@ services:
3535
- REFRESH_JOB_STATUSES_BACKGROUND=yes
3636
- REFRESH_JOB_STATUSES_BACKGROUND_INTERVAL=60
3737
- MAINTENANCE_MODE=no
38+
- CASE_INSENSITIVE_USERNAMES=yes
39+
- CSRF_TRUSTED_ORIGINS="https://qc-copernicus.eea.europa.eu,http://localhost,http://127.0.0.1"
3840
networks:
3941
- qc_tool_network
4042
volumes:
@@ -45,7 +47,7 @@ services:
4547
- qc_tool_frontend:/mnt/qc_tool_frontend
4648

4749
worker:
48-
image: eeacms/copernicus-qctool-worker:2.3.3
50+
image: eeacms/copernicus-qctool-worker:2.3.4rc1
4951
shm_size: 1gb
5052
environment:
5153
- PRODUCT_DIRS

docker/docker-compose.jiri.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ services:
1919
- SUBMISSION_DIR=/mnt/qc_tool_submission/submission
2020
- FRONTEND_DB_PATH=/mnt/qc_tool_work/frontend.sqlite3
2121
- CASE_INSENSITIVE_USERNAMES=yes
22+
- CSRF_TRUSTED_ORIGINS="https://qc-copernicus.eea.europa.eu,http://localhost,http://127.0.0.1"
2223
networks:
2324
- qc_tool_network
2425
volumes:

docker/docker-compose.jtom.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ services:
1717
- WORK_DIR=/mnt/qc_tool_work
1818
- SUBMISSION_DIR=/mnt/qc_tool_submission/submission
1919
- FRONTEND_DB_PATH=/mnt/qc_tool_work/frontend.sqlite3
20+
- CSRF_TRUSTED_ORIGINS="https://qc-copernicus.eea.europa.eu,http://localhost,http://127.0.0.1"
2021
networks:
2122
- qc_tool_network
2223
volumes:

docker/docker-compose.jtomh.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ services:
1616
- WORK_DIR=/mnt/qc_tool_work
1717
- SUBMISSION_DIR=/mnt/qc_tool_submission/submission
1818
- FRONTEND_DB_PATH=/mnt/qc_tool_work/frontend.sqlite3
19+
- CSRF_TRUSTED_ORIGINS="https://qc-copernicus.eea.europa.eu,http://localhost,http://127.0.0.1"
1920
networks:
2021
- qc_tool_network
2122
volumes:

docker/docker-compose.postgres_userdb.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ services:
3838
- POSTGRES_USER=qc_user
3939
- POSTGRES_PASSWORD=qc_password
4040
- FRONTEND_DB_PATH=/mnt/qc_tool_work/frontend.sqlite3
41+
- CSRF_TRUSTED_ORIGINS="https://qc-copernicus.eea.europa.eu,http://localhost,http://127.0.0.1"
4142
networks:
4243
- qc_tool_network
4344
volumes:

docker/docker-compose.service_provider.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
services:
22
frontend:
3-
image: eeacms/copernicus-qctool-frontend:2.3.3
3+
image: eeacms/copernicus-qctool-frontend:2.3.4rc1
44
ports:
55
- 8000:8000
66
environment:
@@ -15,13 +15,14 @@ services:
1515
- WORKER_ALIVE_TIMEOUT=5
1616
- REFRESH_JOB_STATUSES_BACKGROUND=yes
1717
- REFRESH_JOB_STATUSES_BACKGROUND_INTERVAL=60
18+
- CSRF_TRUSTED_ORIGINS="https://qc-copernicus.eea.europa.eu,http://localhost,http://127.0.0.1"
1819
networks:
1920
- qc_tool_network
2021
volumes:
2122
- qc_tool_volume:/mnt/qc_tool_volume
2223

2324
worker:
24-
image: eeacms/copernicus-qctool-worker:2.3.3
25+
image: eeacms/copernicus-qctool-worker:2.3.4rc1
2526
shm_size: 1gb
2627
environment:
2728
- PRODUCT_DIRS

src/qc_tool/frontend/settings.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,13 @@
3232

3333
ALLOWED_HOSTS = ['*']
3434

35-
CSRF_TRUSTED_ORIGINS = ['https://qc-copernicus.eea.europa.eu', 'http://localhost', 'http://127.0.0.1']
35+
# CSRF_TRUSTED_ORIGINS = ['https://qc-copernicus.eea.europa.eu', 'http://localhost', 'http://127.0.0.1']
36+
# CSRF_TRUSTED_ORIGINS from environment variable.
37+
# Get the string from environment, default to empty string if not found
38+
# Split by comma and filter out any empty strings
39+
env_origins = os.getenv('CSRF_TRUSTED_ORIGINS', '')
40+
41+
CSRF_TRUSTED_ORIGINS = [origin.strip() for origin in env_origins.split(',') if origin.strip()]
3642

3743
DEFAULT_AUTO_FIELD = "django.db.models.BigAutoField"
3844

0 commit comments

Comments
 (0)