Added auto admin creation
This commit is contained in:
@@ -59,6 +59,7 @@ def create_sqlite_auth_service(db_path: str,
|
||||
|
||||
def create_auth_app_for_sqlite(db_path: str,
|
||||
jwt_secret: str,
|
||||
create_admin_user: bool = True,
|
||||
email_service: Optional[EmailService] = None):
|
||||
"""
|
||||
Creates an application router designed to use with an SQLite database backend.
|
||||
@@ -69,11 +70,14 @@ def create_auth_app_for_sqlite(db_path: str,
|
||||
|
||||
:param db_path: Path to the SQLite database file.
|
||||
:param jwt_secret: A secret string used for signing and verifying JWT tokens.
|
||||
:param create_admin_user: Create an admin user if necessary.
|
||||
:param email_service: An optional email service instance for managing email-related
|
||||
communication and functionalities during authentication.
|
||||
:return: An application router configured for handling authentication API routes.
|
||||
"""
|
||||
auth_service = create_sqlite_auth_service(db_path, jwt_secret, email_service)
|
||||
if create_admin_user:
|
||||
auth_service.create_admin_if_needed()
|
||||
from .api.routes import create_auth_app
|
||||
return create_auth_app(auth_service)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user