Skip to content

Commit fc41da8

Browse files
authored
Merge pull request #254 from kagenti/fix/respect-port-env-var
fix: Read HOST and PORT from env vars instead of hardcoding
2 parents bed5603 + 9ed9693 commit fc41da8

25 files changed

Lines changed: 49 additions & 33 deletions

File tree

a2a/cheerup_agent/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@ ENV PRODUCTION_MODE=True \
1111
RUN chown -R 1001:1001 /app
1212
USER 1001
1313

14-
CMD ["uv", "run", "--no-sync", "server", "--host", "0.0.0.0", "--port", "8000"]
14+
CMD ["uv", "run", "--no-sync", "server"]

a2a/cheerup_agent/src/cheerup_agent/agent.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,9 @@ async def agent_card_compat(request: Request) -> JSONResponse:
116116

117117
def run():
118118
"""Runs the A2A Agent application."""
119-
agent_card = get_agent_card(host="0.0.0.0", port=8000)
119+
host = os.getenv("HOST", "0.0.0.0")
120+
port = int(os.getenv("PORT", "8000"))
121+
agent_card = get_agent_card(host=host, port=port)
120122

121123
request_handler = DefaultRequestHandler(
122124
agent_executor=CheerupExecutor(),
@@ -134,4 +136,4 @@ def run():
134136
app.routes.insert(0, Route("/health", health, methods=["GET"]))
135137
app.routes.insert(0, Route("/.well-known/agent-card.json", agent_card_compat, methods=["GET"]))
136138

137-
uvicorn.run(app, host="0.0.0.0", port=8000)
139+
uvicorn.run(app, host=host, port=port)

a2a/file_organizer/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@ ENV PRODUCTION_MODE=True \
1111
RUN chown -R 1001:1001 /app
1212
USER 1001
1313

14-
CMD ["uv", "run", "--no-sync", "server", "--host", "0.0.0.0", "--port", "8000"]
14+
CMD ["uv", "run", "--no-sync", "server"]

a2a/file_organizer/src/file_organizer/agent.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,9 @@ def run():
170170
"""
171171
Runs the A2A Agent application.
172172
"""
173-
agent_card = get_agent_card(host="0.0.0.0", port=8000)
173+
host = os.getenv("HOST", "0.0.0.0")
174+
port = int(os.getenv("PORT", "8000"))
175+
agent_card = get_agent_card(host=host, port=port)
174176

175177
request_handler = DefaultRequestHandler(
176178
agent_executor=FileOrganizerExecutor(),
@@ -195,4 +197,4 @@ def run():
195197
),
196198
)
197199

198-
uvicorn.run(app, host="0.0.0.0", port=8000)
200+
uvicorn.run(app, host=host, port=port)

a2a/generic_agent/src/generic_agent/agent.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,9 @@ def run():
186186
"""
187187
Runs the A2A Agent application.
188188
"""
189-
agent_card = get_agent_card(host="0.0.0.0", port=8000)
189+
host = os.getenv("HOST", "0.0.0.0")
190+
port = int(os.getenv("PORT", "8000"))
191+
agent_card = get_agent_card(host=host, port=port)
190192

191193
request_handler = DefaultRequestHandler(
192194
agent_executor=GenericExecutor(),
@@ -211,4 +213,4 @@ def run():
211213
),
212214
)
213215

214-
uvicorn.run(app, host="0.0.0.0", port=8000)
216+
uvicorn.run(app, host=host, port=port)

a2a/git_issue_agent/.env.ollama

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ LLM_API_KEY=ollama
1515
MODEL_TEMPERATURE=0
1616

1717
# Agent service
18-
SERVICE_PORT=8000
18+
PORT=8000
1919
LOG_LEVEL=DEBUG
2020

2121
# MCP Tool endpoint

a2a/git_issue_agent/.env.openai

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ LLM_API_KEY='{"valueFrom": {"secretKeyRef": {"name": "openai-secret", "key": "ap
1212
OPENAI_API_KEY='{"valueFrom": {"secretKeyRef": {"name": "openai-secret", "key": "apikey"}}}'
1313

1414
# Agent service
15-
SERVICE_PORT=8000
15+
PORT=8000
1616
LOG_LEVEL=DEBUG
1717

1818
# MCP Tool endpoint

a2a/git_issue_agent/.env.template

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@ LLM_API_BASE = "http://host.docker.internal:11434"
33
LLM_API_KEY = "ollama"
44
MODEL_TEMPERATURE = 0
55
MCP_URL = "https://api.githubcopilot.com/mcp/"
6-
SERVICE_PORT = 8000
6+
PORT = 8000
77
LOG_LEVEL = "INFO"
88
GITHUB_TOKEN = ""

a2a/git_issue_agent/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@ ENV PRODUCTION_MODE=True \
1212
RUN chown -R 1001:1001 /app
1313
USER 1001
1414

15-
CMD ["uv", "run", "--no-sync", "server", "--host", "0.0.0.0", "--port", "8000"]
15+
CMD ["uv", "run", "--no-sync", "server"]

a2a/git_issue_agent/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ The Github Issue Agent is designed to perform tasks dealing with Github issues,
1818
| EXTRA_HEADERS | Extra headers for the OpenAI API, e.g. {"MY_HEADER": "my_value"} | No | `{}` |
1919
| MODEL_TEMPERATURE | The temperature for the model | Yes | `0` |
2020
| MCP_URL | Endpoint where the Slack MCP server can be found | No | "" |
21-
| SERVICE_PORT | Port on which the service will run | Yes | `8000` |
21+
| PORT | Port on which the service will run | Yes | `8000` |
2222
| LOG_LEVEL | Application log level | No | DEBUG |
2323
| GITHUB_TOKEN | If set, will send requests to Github MCP Server with `Authorization: Bearer <GITHUB_TOKEN>` header. | No | - |
2424
| JWKS_URI | Endpoint to obtain JWKS for token validation. Enables token validation. | No | - |

0 commit comments

Comments
 (0)