Oliver Traber
cf4d3788bd
All checks were successful
ci/woodpecker/push/docker Pipeline was successful
41 lines
1.1 KiB
Python
41 lines
1.1 KiB
Python
from dotenv import load_dotenv
|
|
from fastapi import FastAPI
|
|
from starlette.middleware.authentication import AuthenticationMiddleware
|
|
|
|
load_dotenv()
|
|
|
|
from app.routers import (
|
|
chargepoint_v1,
|
|
id_token_v1,
|
|
meter_value_v1,
|
|
ocpp_v1,
|
|
transaction_v1,
|
|
user_v1
|
|
)
|
|
from app.util.websocket_auth_backend import BasicAuthBackend
|
|
|
|
def create_ocpp_app():
|
|
app_ocpp = FastAPI(
|
|
responses={404: {"description": "Not found"}},
|
|
)
|
|
app_ocpp.include_router(ocpp_v1.router)
|
|
app_ocpp.add_middleware(AuthenticationMiddleware, backend=BasicAuthBackend())
|
|
|
|
return app_ocpp
|
|
|
|
def create_app():
|
|
app = FastAPI(
|
|
responses={404: {"description": "Not found"}},
|
|
)
|
|
|
|
app.include_router(chargepoint_v1.router, prefix="/v1")
|
|
app.include_router(id_token_v1.router, prefix="/v1")
|
|
app.include_router(user_v1.router, prefix="/v1")
|
|
app.include_router(meter_value_v1.router, prefix="/v1")
|
|
app.include_router(transaction_v1.router, prefix="/v1")
|
|
app.mount(path="/v1/ocpp", app=create_ocpp_app())
|
|
|
|
return app
|
|
|
|
app = create_app()
|