Skip to content
Snippets Groups Projects
Commit b459f8b2 authored by Daniel Göbel's avatar Daniel Göbel
Browse files

Merge branch 'bugfix/13-fix-typo-in-dockerfile' into 'main'

Resolve "Fix typo in Dockerfile"

Closes #13

See merge request !13
parents d4be6360 312a866e
No related branches found
No related tags found
1 merge request!13Resolve "Fix typo in Dockerfile"
Pipeline #55057 passed
...@@ -18,7 +18,7 @@ WORKDIR /home/worker/code ...@@ -18,7 +18,7 @@ WORKDIR /home/worker/code
ENV PYTHONPATH=/home/worker/code ENV PYTHONPATH=/home/worker/code
ENV PATH="/home/worker/.local/bin:${PATH}" ENV PATH="/home/worker/.local/bin:${PATH}"
COPY ../start_service_uvicorn.sh ./entrypoint.sh COPY ./start_service_uvicorn.sh ./entrypoint.sh
COPY scripts/prestart.sh ./prestart.sh COPY scripts/prestart.sh ./prestart.sh
CMD ["./entrypoint.sh"] CMD ["./entrypoint.sh"]
......
FROM python:3.12-slim FROM python:3.12-slim
ENV PORT=8000 ENV PORT=8000
ENV OTEL_INSTRUMENTATION_HTTP_CAPTURE_HEADERS_SANITIZE_FIELDS="set-cookie"
EXPOSE $PORT EXPOSE $PORT
WORKDIR /app/ WORKDIR /app/
ENV PYTHONPATH=/app ENV PYTHONPATH=/app
......
...@@ -45,12 +45,14 @@ class UserOutExtended(UserOut, UserRoles): ...@@ -45,12 +45,14 @@ class UserOutExtended(UserOut, UserRoles):
invitation_token_created_at: int | None = Field( invitation_token_created_at: int | None = Field(
None, description="Timestamp when the invitation token was created as UNIX timestamp" None, description="Timestamp when the invitation token was created as UNIX timestamp"
) )
gravatar_url: URL | None = Field(default=None, description="URL to the gravatar avatar based on the users email") gravatar_url: URL = Field(description="URL to the gravatar avatar based on the users email")
@staticmethod @staticmethod
def generate_gravatar_url(email: str | None) -> AnyHttpUrl | None: def generate_gravatar_url(email: str | None) -> AnyHttpUrl:
if email is None: if email is None:
return None return AnyHttpUrl(
"https://gravatar.com/avatar/87a8c45825eb709ee8e453d2c0f8154e1b9bf4b45bb9b81b7662177340aa9d38"
)
return AnyHttpUrl(f"https://gravatar.com/avatar/{sha256(email.strip().lower().encode('utf-8')).hexdigest()}") return AnyHttpUrl(f"https://gravatar.com/avatar/{sha256(email.strip().lower().encode('utf-8')).hexdigest()}")
@staticmethod @staticmethod
......
...@@ -3,7 +3,10 @@ from clowm.schemas.user import UserOutExtended ...@@ -3,7 +3,10 @@ from clowm.schemas.user import UserOutExtended
class TestGravatar: class TestGravatar:
def test_gravatar_url_for_none_email(self) -> None: def test_gravatar_url_for_none_email(self) -> None:
assert UserOutExtended.generate_gravatar_url(email=None) is None assert (
str(UserOutExtended.generate_gravatar_url(email=None))
== "https://gravatar.com/avatar/87a8c45825eb709ee8e453d2c0f8154e1b9bf4b45bb9b81b7662177340aa9d38"
)
def test_gravatar_url_for_email(self) -> None: def test_gravatar_url_for_email(self) -> None:
assert ( assert (
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment