Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
1 change: 0 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ SECRET_KEY=xxx

SENTRY_DSN=https://abcdefg@your.sentry.here/999
SENTRY_ENVIRONMENT=dev
SENTRY_ENABLE_TRACING=0
SENTRY_TRACES_SAMPLE_RATE=0.1

ALLOWED_HOSTS=*
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
uses: City-of-Helsinki/.github/.github/workflows/ci-django-api.yml@main
secrets: inherit
with:
postgres-major-version: 13
python-version: 3.12
postgres-major-version: 17
extra-commands: |
echo 'SECRET_KEY=topsecret123' >> .env
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ If you encounter deprecation warnings on newer versions, you may need to downgra

### PostgreSQL

Postgresql 13 is the minimum version required. You can check your version by running `psql --version`.
Postgresql 17 is the minimum version required. You can check your version by running `psql --version`.

If you are running the project without Docker, you may need to install and configure PostgreSQL manually. The default configuration file is `docker-compose.env`, which you may need to adjust for your local setup.

Expand Down
4 changes: 2 additions & 2 deletions docker-compose.yml → compose.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
services:
postgres:
image: postgres:13
image: postgres:17-alpine
restart: on-failure
environment:
POSTGRES_USER: notification_service
Expand All @@ -11,7 +11,7 @@ services:
# networks:
# - helsinki
volumes:
- pgdata:/var/lib/postgresql@13/data
- pgdata:/var/lib/postgresql@17/data
container_name: notification_service-db

keycloak:
Expand Down
1 change: 0 additions & 1 deletion docker-compose.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ SECRET_KEY=xxx

SENTRY_DSN=https://abcdefg@your.sentry.here/999
SENTRY_ENVIRONMENT=dev
SENTRY_ENABLE_TRACING=0
SENTRY_TRACES_SAMPLE_RATE=0.1

ALLOWED_HOSTS=*
2 changes: 1 addition & 1 deletion docs/development-without-docker.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Please refer to the [main README](/README.md) for the latest instructions.

## Prerequisites

- PostgreSQL 13
- PostgreSQL 17
- Python 3.12
- Keycloak

Expand Down
11 changes: 0 additions & 11 deletions notification_service/constants.py

This file was deleted.

15 changes: 8 additions & 7 deletions notification_service/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,10 @@

import environ
import sentry_sdk
from csp.constants import SELF
from django.utils.translation import gettext_lazy as _
from sentry_sdk.integrations.django import DjangoIntegration

from notification_service.constants import CSP

checkout_dir = environ.Path(__file__) - 2
assert os.path.exists(checkout_dir("manage.py"))

Expand Down Expand Up @@ -37,7 +36,6 @@
QURIIRI_REPORT_URL=(str, ""),
SECRET_KEY=(str, ""),
SENTRY_DSN=(str, None),
SENTRY_ENABLE_TRACING=(bool, False),
SENTRY_ENVIRONMENT=(str, ""),
SENTRY_TRACES_SAMPLE_RATE=(float, 0.1),
SOCIAL_AUTH_TUNNISTAMO_KEY=(str, "KEY_UNSET"),
Expand Down Expand Up @@ -87,7 +85,6 @@
dsn=env.str("SENTRY_DSN"),
release=REVISION,
environment=env("SENTRY_ENVIRONMENT"),
enable_tracing=env.bool("SENTRY_ENABLE_TRACING"),
traces_sample_rate=env.float("SENTRY_TRACES_SAMPLE_RATE"),
integrations=[DjangoIntegration()],
)
Expand Down Expand Up @@ -165,11 +162,15 @@
CORS_ALLOW_ALL_ORIGINS = env.bool("CORS_ALLOW_ALL_ORIGINS")
CORS_ALLOW_CREDENTIALS = True

# Configure the default CSP rule for different source types
CSP_DEFAULT_SRC = [CSP.SELF]
# Configure default CSP rules for different source types
# NOTE: CSP_STYLE_SRC="'unsafe-inline'" is needed for the inline styles that are added
# by the `django-helusers` to the base_admin_site.html
CSP_STYLE_SRC = [CSP.SELF, CSP.UNSAFE_INLINE]
CONTENT_SECURITY_POLICY = {
"DIRECTIVES": {
"default-src": [SELF],
"style-src": [SELF, "'unsafe-inline'"],
}
}

AUTHENTICATION_BACKENDS = [
"helusers.tunnistamo_oidc.TunnistamoOIDCAuth",
Expand Down
271 changes: 152 additions & 119 deletions requirements-dev.txt

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions requirements-prod.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
#
# pip-compile --allow-unsafe --generate-hashes --strip-extras requirements-prod.in
#
uwsgi==2.0.27 \
--hash=sha256:3ee5bfb7e6e9c93478c22aa8183eef35b95a2d5b14cca16172e67f135565c458
uwsgi==2.0.30 \
--hash=sha256:c12aa652124f062ac216077da59f6d247bd7ef938234445881552e58afb1eb5f
# via -r requirements-prod.in
2 changes: 1 addition & 1 deletion requirements.in
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
django
django~=5.2
django-cors-headers
django-csp
django-environ
Expand Down
626 changes: 319 additions & 307 deletions requirements.txt

Large diffs are not rendered by default.

18 changes: 18 additions & 0 deletions users/migrations/0003_user_last_api_use.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 5.2.6 on 2025-09-18 18:03

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('users', '0002_alter_user_first_name'),
]

operations = [
migrations.AddField(
model_name='user',
name='last_api_use',
field=models.DateField(blank=True, null=True, verbose_name='Latest API token usage date'),
),
]