Skip to content

Commit efefd96

Browse files
author
maxim-lixakov
committed
[DOP-21268] - update RTD config
1 parent 6824462 commit efefd96

File tree

5 files changed

+18
-9
lines changed

5 files changed

+18
-9
lines changed

.readthedocs.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ build:
1717
- VIRTUAL_ENV=$READTHEDOCS_VIRTUALENV_PATH python -m poetry install --no-root --all-extras --with docs --without dev,test
1818
- VIRTUAL_ENV=$READTHEDOCS_VIRTUALENV_PATH python -m poetry show -v
1919
- python -m pip list -v
20-
- SYNCMASTER__DATABASE__URL=postgresql+psycopg://fake:[email protected]:5432/fake SYNCMASTER__BROKER__URL=amqp://fake:faket@fake:5672/ SYNCMASTER__CRYPTO_KEY=crypto_key python -m syncmaster.backend.export_openapi_schema docs/_static/openapi.json
20+
- SYNCMASTER__DATABASE__URL=postgresql+psycopg://fake:[email protected]:5432/fake SYNCMASTER__BROKER__URL=amqp://fake:faket@fake:5672/ SYNCMASTER__CRYPTO_KEY=crypto_key SYNCMASTER__AUTH__ACCESS_TOKEN__SECRET_KEY=fakepython python -m syncmaster.backend.export_openapi_schema docs/_static/openapi.json
2121

2222
sphinx:
2323
configuration: docs/conf.py
Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,13 @@
1-
TODO
1+
- Implemented ``KeycloakAuthProvider`` for Single Sign-On (SSO) authentication.
2+
- Implemented ``DummyAuthProvider`` for development and testing environments.
3+
- Enabled dynamic selection of authentication provider via environment variable SYNCMASTER__AUTH__PROVIDER:
4+
5+
.. code::
6+
7+
# syncmaster.backend.providers.auth.keycloak_provider.KeycloakAuthProvider for Keycloak.
8+
SYNCMASTER__AUTH__PROVIDER=syncmaster.backend.providers.auth.keycloak_provider.KeycloakAuthProvider
9+
10+
# syncmaster.backend.providers.auth.dummy_provider.DummyAuthProvider for Dummy authentication.
11+
SYNCMASTER__AUTH__PROVIDER=syncmaster.backend.providers.auth.dummy_provider.DummyAuthProvider
12+
13+
- Updated ``User`` model to include ``email``, ``first_name``, ``middle_name``, and ``last_name`` fields.

syncmaster/backend/__init__.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
# SPDX-FileCopyrightText: 2023-2024 MTS PJSC
22
# SPDX-License-Identifier: Apache-2.0
3-
from typing import Type
4-
53
from fastapi import FastAPI, HTTPException
64
from fastapi.exceptions import RequestValidationError
75
from pydantic import ValidationError
@@ -49,7 +47,7 @@ def application_factory(settings: Settings) -> FastAPI:
4947
},
5048
)
5149

52-
auth_class: type[AuthProvider] = settings.auth.provider # type: ignore[assignment]
50+
auth_class = settings.auth.provider
5351
auth_class.setup(application)
5452

5553
apply_middlewares(application, settings)

syncmaster/backend/export_openapi_schema.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,15 @@
77

88
from fastapi import FastAPI
99

10-
from syncmaster.backend import application_factory
11-
from syncmaster.backend.settings import BackendSettings as Settings
10+
from syncmaster.backend import get_application
1211

1312

1413
def get_openapi_schema(app: FastAPI) -> dict:
1514
return app.openapi()
1615

1716

1817
if __name__ == "__main__":
19-
settings = Settings()
20-
app = application_factory(settings)
18+
app = get_application()
2119
schema = get_openapi_schema(app)
2220
file_path = sys.argv[1]
2321
if not file_path:

syncmaster/db/migrations/versions/2023-11-23_0001_create_user_table.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ def upgrade():
3232
sa.Column("updated_at", sa.DateTime(), server_default=sa.text("now()"), nullable=False),
3333
sa.Column("is_deleted", sa.Boolean(), nullable=False),
3434
sa.PrimaryKeyConstraint("id", name=op.f("pk__user")),
35+
sa.UniqueConstraint("email", name=op.f("uq__user__email")),
3536
)
3637
op.create_index(op.f("ix__user__username"), "user", ["username"], unique=True)
3738

0 commit comments

Comments
 (0)