Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
CloWM Backend
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Monitor
Service Desk
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Computational Metagenomics
CloWM
CloWM Backend
Commits
312a866e
Verified
Commit
312a866e
authored
8 months ago
by
Daniel Göbel
Browse files
Options
Downloads
Patches
Plain Diff
Fix Dockerfile and make gravatar url in use schema mandatory
#13
parent
d4be6360
No related branches found
No related tags found
1 merge request
!13
Resolve "Fix typo in Dockerfile"
Pipeline
#55051
passed
8 months ago
Stage: lint
Stage: test
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
Dockerfile
+1
-1
1 addition, 1 deletion
Dockerfile
Dockerfile-Gunicorn
+1
-0
1 addition, 0 deletions
Dockerfile-Gunicorn
clowm/schemas/user.py
+5
-3
5 additions, 3 deletions
clowm/schemas/user.py
clowm/tests/unit/test_gravatar_url.py
+4
-1
4 additions, 1 deletion
clowm/tests/unit/test_gravatar_url.py
with
11 additions
and
5 deletions
Dockerfile
+
1
−
1
View file @
312a866e
...
...
@@ -18,7 +18,7 @@ WORKDIR /home/worker/code
ENV
PYTHONPATH=/home/worker/code
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
CMD
["./entrypoint.sh"]
...
...
This diff is collapsed.
Click to expand it.
Dockerfile-Gunicorn
+
1
−
0
View file @
312a866e
FROM python:3.12-slim
ENV PORT=8000
ENV OTEL_INSTRUMENTATION_HTTP_CAPTURE_HEADERS_SANITIZE_FIELDS="set-cookie"
EXPOSE $PORT
WORKDIR /app/
ENV PYTHONPATH=/app
...
...
This diff is collapsed.
Click to expand it.
clowm/schemas/user.py
+
5
−
3
View file @
312a866e
...
...
@@ -45,12 +45,14 @@ class UserOutExtended(UserOut, UserRoles):
invitation_token_created_at
:
int
|
None
=
Field
(
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
def
generate_gravatar_url
(
email
:
str
|
None
)
->
AnyHttpUrl
|
None
:
def
generate_gravatar_url
(
email
:
str
|
None
)
->
AnyHttpUrl
:
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
()
}
"
)
@staticmethod
...
...
This diff is collapsed.
Click to expand it.
clowm/tests/unit/test_gravatar_url.py
+
4
−
1
View file @
312a866e
...
...
@@ -3,7 +3,10 @@ from clowm.schemas.user import UserOutExtended
class
TestGravatar
:
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
:
assert
(
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment