Skip to content

Commit

Permalink
Change lifespan only
Browse files Browse the repository at this point in the history
  • Loading branch information
talsabagport committed Nov 10, 2024
1 parent 51c5b18 commit 5c39d67
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
3 changes: 0 additions & 3 deletions integrations/jira/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,6 @@ async def handle_webhook_request(data: dict[str, Any]) -> dict[str, Any]:
return {"ok": True}


ocean.app.fast_api_app.include_router(ocean.router, prefix="/integration")


# Called once when the integration starts.
@ocean.on_start()
async def on_start() -> None:
Expand Down
9 changes: 8 additions & 1 deletion port_ocean/ocean.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ async def lifespan(_: FastAPI) -> AsyncIterator[None]:
signal_handler.exit()

self.fast_api_app = app or FastAPI(lifespan=lifespan)
# self.fast_api_app.middleware("http")(request_handler)
self.fast_api_app.middleware("http")(request_handler)

self.config = IntegrationConfiguration(
# type: ignore
Expand All @@ -67,6 +67,7 @@ async def lifespan(_: FastAPI) -> AsyncIterator[None]:
*self.config.get_sensitive_fields_data()
)
self.integration_router = integration_router or APIRouter()
self.integration_router_included = False

self.port_client = PortClient(
base_url=self.config.port.base_url,
Expand Down Expand Up @@ -127,4 +128,10 @@ async def execute_resync_all() -> None:
await repeated_function()

async def __call__(self, scope: Scope, receive: Receive, send: Send) -> None:
if not self.integration_router_included:
self.fast_api_app.include_router(
self.integration_router, prefix="/integration"
)
self.integration_router_included = True

await self.fast_api_app(scope, receive, send)
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "port-ocean"
version = "0.12.9-dev01"
version = "0.12.9-dev02"
description = "Port Ocean is a CLI tool for managing your Port projects."
readme = "README.md"
homepage = "https://app.getport.io"
Expand Down

0 comments on commit 5c39d67

Please sign in to comment.