Skip to content

Commit

Permalink
Refactor: Update configuration for database ports and remove unused d…
Browse files Browse the repository at this point in the history
…ependencies; enhance API server settings
  • Loading branch information
Luisotee committed Jan 22, 2025
1 parent 16e93d2 commit 26b7f45
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 26 deletions.
11 changes: 7 additions & 4 deletions apps/ai_api/eda_ai_api/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,15 @@ def run_server() -> None:

# Use localhost for development, configure via config for production
host = "127.0.0.1" # Default to localhost
if config.services.ai_api.get(
"allow_external", False
): # Only if explicitly enabled
if (
hasattr(config.services.ai_api, "allow_external")
and config.services.ai_api.allow_external
):
host = "0.0.0.0" # nosec B104 # Explicitly allowed in config

uvicorn.run("eda_ai_api.main:app", host=host, port=config.ports.ai_api, reload=True)
uvicorn.run(
"eda_ai_api.main:app", host=host, port=config.ports.ai_api, reload=True
)


if __name__ == "__main__":
Expand Down
18 changes: 1 addition & 17 deletions apps/ai_api/uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions config.example.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ ports:
landingpage: 8081
docs: 8082
db:
postgres: 5432
postgres: 5439
trigger_postgres: 5440
langtrace_postgres: 5441
redis: 6379
neo4j:
http: 7474 # Neo4j browser interface
Expand Down Expand Up @@ -114,7 +116,7 @@ services:
trigger:
project_id: "xxx"
api_url: "http://localhost:3040"
environment: "development"
environment: "production"
runtime: "docker-compose"
v3_enabled: true
concurrency:
Expand Down
2 changes: 1 addition & 1 deletion deploy/trigger-stack/export-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const envVars = {
DIRECT_URL: `postgresql://${config.databases.trigger_postgres.user}:${config.databases.trigger_postgres.password}@postgres:5432/${config.databases.trigger_postgres.database}`, // Add this line

// Add database ports
POSTGRES_PORT: config.ports.db.postgres,
POSTGRES_PORT: config.ports.db.trigger_postgres, // Use trigger-specific port
REDIS_PORT: config.ports.db.redis,

// Redis settings
Expand Down
2 changes: 2 additions & 0 deletions packages/config/python/eda_config/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ class ApiKeys(BaseModel):

class DbPorts(BaseModel):
postgres: int
trigger_postgres: int # Add new port
langtrace_postgres: int # Add new port
redis: int
neo4j: Dict[str, int]
clickhouse: int
Expand Down
2 changes: 1 addition & 1 deletion packages/config/python/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "eda-config"
version = "0.1.16"
version = "0.1.19"
description = "Configuration management for EDA"
requires-python = ">=3.11"
dependencies = [
Expand Down
2 changes: 1 addition & 1 deletion packages/config/typescript/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@eda/config",
"version": "0.1.11",
"version": "0.1.14",
"main": "dist/config.js",
"types": "dist/config.d.ts",
"type": "module",
Expand Down
2 changes: 2 additions & 0 deletions packages/config/typescript/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,8 @@ export const ConfigSchema = z.object({
docs: z.number(),
db: z.object({
postgres: z.number(),
trigger_postgres: z.number(), // Add new port
langtrace_postgres: z.number(), // Add new port
redis: z.number(),
neo4j: z.object({
http: z.number(),
Expand Down

0 comments on commit 26b7f45

Please sign in to comment.