File tree Expand file tree Collapse file tree 12 files changed +93
-13
lines changed
docs/backend/configuration Expand file tree Collapse file tree 12 files changed +93
-13
lines changed Original file line number Diff line number Diff line change @@ -9,6 +9,9 @@ SYNCMASTER__LOGGING__SETUP=True
99SYNCMASTER__LOGGING__PRESET=colored
1010SYNCMASTER__LOG_URL_TEMPLATE=https://grafana.example.com?correlation_id={{ correlation_id }}&run_id={{ run.id }}
1111
12+ # Session
13+ SYNCMASTER__SERVER__SESSION__SECRET_KEY=session_secret_key
14+
1215# Encrypt / Decrypt credentials data
1316SYNCMASTER__CRYPTO_KEY=UBgPTioFrtH2unlC4XFDiGf5sYfzbdSf_VgiUSaQc94=
1417
Original file line number Diff line number Diff line change @@ -9,6 +9,9 @@ export SYNCMASTER__LOGGING__SETUP=True
99export SYNCMASTER__LOGGING__PRESET = colored
1010export SYNCMASTER__LOG_URL_TEMPLATE = " https://grafana.example.com?correlation_id={{ correlation_id }}&run_id={{ run.id }}"
1111
12+ # Session
13+ export SYNCMASTER__SERVER__SESSION__SECRET_KEY = session_secret_key
14+
1215# Encrypt / Decrypt credentials data
1316export SYNCMASTER__CRYPTO_KEY = UBgPTioFrtH2unlC4XFDiGf5sYfzbdSf_VgiUSaQc94=
1417
Original file line number Diff line number Diff line change @@ -5,4 +5,4 @@ CORS settings
55
66These settings used to control `CORS <https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS >`_ options.
77
8- .. autopydantic_model :: syncmaster.settings.server.cors.CORSSettings
8+ .. autopydantic_model :: syncmaster.backend. settings.server.cors.CORSSettings
Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ Configuration
1111 database
1212 broker
1313 logging
14+ session
1415 cors
1516 debug
1617 monitoring
Original file line number Diff line number Diff line change @@ -13,4 +13,4 @@ REST API server provides the following endpoints with Prometheus compatible metr
1313
1414These endpoints are enabled and configured using settings below:
1515
16- .. autopydantic_model :: syncmaster.settings.server.monitoring.MonitoringSettings
16+ .. autopydantic_model :: syncmaster.backend. settings.server.monitoring.MonitoringSettings
Original file line number Diff line number Diff line change @@ -5,8 +5,8 @@ OpenAPI settings
55
66These settings used to control exposing OpenAPI.json and SwaggerUI/ReDoc endpoints.
77
8- .. autopydantic_model :: syncmaster.settings.server.openapi.OpenAPISettings
9- .. autopydantic_model :: syncmaster.settings.server.openapi.SwaggerSettings
10- .. autopydantic_model :: syncmaster.settings.server.openapi.RedocSettings
11- .. autopydantic_model :: syncmaster.settings.server.openapi.LogoSettings
12- .. autopydantic_model :: syncmaster.settings.server.openapi.FaviconSettings
8+ .. autopydantic_model :: syncmaster.backend. settings.server.openapi.OpenAPISettings
9+ .. autopydantic_model :: syncmaster.backend. settings.server.openapi.SwaggerSettings
10+ .. autopydantic_model :: syncmaster.backend. settings.server.openapi.RedocSettings
11+ .. autopydantic_model :: syncmaster.backend. settings.server.openapi.LogoSettings
12+ .. autopydantic_model :: syncmaster.backend. settings.server.openapi.FaviconSettings
Original file line number Diff line number Diff line change 1+ .. _backend-configuration-server-session :
2+
3+ Session settings
4+ ================
5+
6+ These settings used to control `Session <https://developer.mozilla.org/en-US/docs/Web/HTTP/Session >`_ options.
7+
8+ .. autopydantic_model :: syncmaster.backend.settings.server.session.SessionSettings
Original file line number Diff line number Diff line change @@ -5,4 +5,4 @@ Serving static files
55
66These settings used to control serving static files by a server.
77
8- .. autopydantic_model :: syncmaster.settings.server.static_files.StaticFilesSettings
8+ .. autopydantic_model :: syncmaster.backend. settings.server.static_files.StaticFilesSettings
Original file line number Diff line number Diff line change @@ -29,6 +29,6 @@ def apply_middlewares(
2929 apply_request_id_middleware (application , settings .server .request_id )
3030 apply_openapi_middleware (application , settings .server .openapi )
3131 apply_static_files (application , settings .server .static_files )
32- apply_session_middleware (application )
32+ apply_session_middleware (application , settings . server . session )
3333
3434 return application
Original file line number Diff line number Diff line change 11# SPDX-FileCopyrightText: 2023-2024 MTS PJSC
22# SPDX-License-Identifier: Apache-2.0
3- import secrets
43
54from fastapi import FastAPI
65from starlette .middleware .sessions import SessionMiddleware
76
7+ from syncmaster .backend .settings .server .session import SessionSettings
88
9- def apply_session_middleware (app : FastAPI ) -> FastAPI :
9+
10+ def apply_session_middleware (app : FastAPI , settings : SessionSettings ) -> FastAPI :
1011 """Add SessionMiddleware middleware to the application."""
11- secret_key = secrets .token_urlsafe (32 )
12- app .add_middleware (SessionMiddleware , secret_key = secret_key )
12+
13+ app .add_middleware (
14+ SessionMiddleware ,
15+ ** settings .dict (),
16+ )
1317 return app
You can’t perform that action at this time.
0 commit comments