Skip to content
Open
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
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# ----------------------------------------------------
# Base-image
# ----------------------------------------------------
FROM python:3.9-slim-buster as common-base
FROM python:3.9-slim-bookworm as common-base
# Django directions: https://blog.ploetzli.ch/2020/efficient-multi-stage-build-django-docker/
# Pip on docker : https://pythonspeed.com/articles/multi-stage-docker-python/
# https://blog.mikesir87.io/2018/07/leveraging-multi-stage-builds-single-dockerfile-dev-prod/
Expand Down
2 changes: 1 addition & 1 deletion ark/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ def clean(self):

@classmethod
def create(cls, naan: Naan, shoulder: Shoulder):
noid = generate_noid(os.environ.get("ARKLET_NOID_LENGTH", 8))
noid = generate_noid(int(os.environ.get("ARKLET_NOID_LENGTH", 8)))
ark_prefix = f"{naan.naan}{shoulder.shoulder}"
base_ark_string = f"{ark_prefix}{noid}"
check_digit = noid_check_digit(base_ark_string)
Expand Down
19 changes: 10 additions & 9 deletions arklet/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

env = environ.Env(
# set default values
ARKLET_HOST=(str, "127.0.0.1"),
ARKLET_HOST=(list, ["127.0.0.1"]),
ARKLET_DEBUG=(bool, False),
ARKLET_POSTGRES_NAME=(str, "arklet"),
ARKLET_POSTGRES_HOST=(str, "127.0.0.1"),
Expand Down Expand Up @@ -48,19 +48,20 @@
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = env("ARKLET_DEBUG")

ALLOWED_HOSTS = [
env("ARKLET_HOST"),
]
ALLOWED_HOSTS = env.list("ARKLET_HOST")

CSRF_TRUSTED_ORIGINS = [
f"http://*.127.0.0.1",
f"http://*.127.0.0.1:{env('ARKLET_PORT')}",
f"http://*.{env('ARKLET_HOST')}",
f"https://*.{env('ARKLET_HOST')}",
f"http://*.{env('ARKLET_HOST')}:{env('ARKLET_PORT')}",
f"https://*.{env('ARKLET_HOST')}:{env('ARKLET_PORT')}",
f"http://*.127.0.0.1:{env('ARKLET_PORT')}"
]

for allowed_host in ALLOWED_HOSTS:
CSRF_TRUSTED_ORIGINS = CSRF_TRUSTED_ORIGINS + [
f"http://*.{allowed_host}",
f"https://*.{allowed_host}",
f"http://*.{allowed_host}:{env('ARKLET_PORT')}",
f"https://*.{allowed_host}:{env('ARKLET_PORT')}",
]

# Application definition

Expand Down
2 changes: 1 addition & 1 deletion docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# ----------------------------------------------------
# Base-image
# ----------------------------------------------------
FROM python:3.9-slim-buster as common-base
FROM python:3.9-slim-bookworm as common-base
# Django directions: https://blog.ploetzli.ch/2020/efficient-multi-stage-build-django-docker/
# Pip on docker : https://pythonspeed.com/articles/multi-stage-docker-python/
# https://blog.mikesir87.io/2018/07/leveraging-multi-stage-builds-single-dockerfile-dev-prod/
Expand Down
4 changes: 2 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ MarkupSafe==2.0.1
mypy-extensions==0.4.3
pathspec==0.9.0
platformdirs==2.4.0
psycopg2-binary==2.9.1
psycopg2-binary==2.9.10
pytz==2021.3
PyYAML==6.0
PyYAML==6.0.2
regex==2021.10.23
sentry-sdk==1.4.3
sqlparse==0.4.2
Expand Down