Skip to content

Commit 89743c0

Browse files
committed
[DOP-25329] Add example of generating random secret keys
1 parent 11dcba5 commit 89743c0

File tree

2 files changed

+24
-3
lines changed

2 files changed

+24
-3
lines changed

syncmaster/server/settings/auth/jwt.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,11 @@ class JWTSettings(BaseModel):
2323
"""
2424
Secret key for signing JWT tokens.
2525
26-
Can be any string. It is recommended to generate random value for every application instance.
26+
Can be any string. It is recommended to generate random value for every application instance, e.g.:
27+
28+
.. code:: shell
29+
30+
pwgen 32 1
2731
""",
2832
),
2933
)

syncmaster/server/settings/server/session.py

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
# SPDX-License-Identifier: Apache-2.0
33

44

5+
import textwrap
6+
57
from pydantic import BaseModel, ConfigDict, Field
68

79

@@ -38,8 +40,23 @@ class SessionSettings(BaseModel):
3840
3941
"""
4042

41-
secret_key: str = Field(description="A random string for signing cookies.")
42-
session_cookie: str | None = Field(default="session", description="Name of the session cookie.")
43+
secret_key: str = Field(
44+
description=textwrap.dedent(
45+
"""
46+
Secret key for encrypting cookies.
47+
48+
Can be any string. It is recommended to generate random value for every application instance, e.g.:
49+
50+
.. code:: shell
51+
52+
pwgen 32 1
53+
""",
54+
),
55+
)
56+
session_cookie: str | None = Field(
57+
default="session",
58+
description="Name of the session cookie. Change this if there are multiple application under the same domain.",
59+
)
4360
max_age: int | None = Field(
4461
default=14 * 24 * 60 * 60,
4562
description="Session expiry time in seconds. Defaults to 2 weeks.",

0 commit comments

Comments
 (0)