File tree Expand file tree Collapse file tree 3 files changed +27
-4
lines changed
python-interpreter/packages/afm-core/src/afm Expand file tree Collapse file tree 3 files changed +27
-4
lines changed Original file line number Diff line number Diff line change 2727import uvicorn
2828from fastapi import FastAPI
2929
30+ from .constants import DEFAULT_HTTP_PORT
3031from .exceptions import AFMError
3132from .interfaces .base import get_http_path , get_interfaces
3233from .interfaces .console_chat import async_run_console_chat
@@ -59,7 +60,7 @@ def create_unified_app(
5960 webhook_interface : WebhookInterface | None = None ,
6061 startup_event : asyncio .Event | None = None ,
6162 host : str = "0.0.0.0" ,
62- port : int = 8085 ,
63+ port : int = DEFAULT_HTTP_PORT ,
6364) -> FastAPI :
6465 if webchat_interface is None and webhook_interface is None :
6566 raise ValueError ("At least one HTTP interface must be provided" )
@@ -348,9 +349,9 @@ def validate(file: Path) -> None:
348349@click .option (
349350 "--port" ,
350351 "-p" ,
351- default = 8085 ,
352+ default = DEFAULT_HTTP_PORT ,
352353 type = int ,
353- help = "HTTP port for web interfaces (default: 8085 )" ,
354+ help = f "HTTP port for web interfaces (default: { DEFAULT_HTTP_PORT } )" ,
354355)
355356@click .option (
356357 "--host" ,
Original file line number Diff line number Diff line change 1+ # Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).
2+ #
3+ # WSO2 LLC. licenses this file to you under the Apache License,
4+ # Version 2.0 (the "License"); you may not use this file except
5+ # in compliance with the License.
6+ # You may obtain a copy of the License at
7+ #
8+ # http://www.apache.org/licenses/LICENSE-2.0
9+ #
10+ # Unless required by applicable law or agreed to in writing,
11+ # software distributed under the License is distributed on an
12+ # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
13+ # KIND, either express or implied. See the License for the
14+ # specific language governing permissions and limitations
15+ # under the License.
16+
17+ from __future__ import annotations
18+
19+ from typing import Final
20+
21+ DEFAULT_HTTP_PORT : Final = 8085
Original file line number Diff line number Diff line change 2929from fastapi .responses import JSONResponse , PlainTextResponse
3030from pydantic import BaseModel , Field
3131
32+ from ..constants import DEFAULT_HTTP_PORT
3233from ..exceptions import TemplateEvaluationError
3334from ..templates import compile_template , evaluate_template
3435from .base import InterfaceNotFoundError , get_http_path , get_webhook_interface
@@ -375,7 +376,7 @@ def create_webhook_app(
375376 else :
376377 effective_host = "localhost"
377378
378- effective_port = port if port else 8085
379+ effective_port = port if port else DEFAULT_HTTP_PORT
379380
380381 callback_url = f"http://{ effective_host } :{ effective_port } { webhook_path } "
381382 logger .warning (
You can’t perform that action at this time.
0 commit comments