Skip to content

Commit 509d0cc

Browse files
refactor: connfig and environment
1 parent 0acd7ce commit 509d0cc

File tree

6 files changed

+47
-17
lines changed

6 files changed

+47
-17
lines changed

services/frontend/pyproject.toml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,12 @@ description = "Add your description here"
55
readme = "README.md"
66
requires-python = ">=3.13"
77
dependencies = [
8-
"pre-commit>=4.2.0",
98
"pydantic>=2.11.7",
109
"pydantic-settings>=2.10.1",
1110
"streamlit>=1.47.0",
1211
]
12+
13+
[project.optional-dependencies]
14+
dev = [
15+
"pre-commit>=4.2.0",
16+
]

services/retriever/.dockerignore

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1 @@
1-
.venv
2-
.venv/*
31
.venv/

services/retriever/.example.env

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,16 @@
11
POSTGRES_USER=postgres # pragma: allowlist secret
2-
POSTGRES_PASSWORD=mypassword # pragma: allowlist secret
3-
POSTGRES_DB=laiive # pragma: allowlist secret
2+
POSTGRES_PASSWORD=yourpassword # pragma: allowlist secret
3+
POSTGRES_DB=yourdb # pragma: allowlist secret
44
POSTGRES_PORT=5432 # pragma: allowlist secret
5-
POSTGRES_HOST=db # pragma: allowlist secret
5+
POSTGRES_HOST=dbhost # pragma: allowlist secret
66

7-
# POSTGRES_URL=postgresql+asyncpg://${POSTGRES_USER}:${POSTGRES_PASSWORD}@${POSTGRES_HOST}:${POSTGRES_PORT}/${POSTGRES_DB}
8-
9-
# retreiver Api key
7+
POSTGRES_URL=postgresql+asyncpg://postgres:yourpassword@dbhost:5432/yourdb # pragma: allowlist secret
8+
# Note: Manually replace values or construct this URL programmatically in your application
109
OPENAI_API_KEY="your-api-key" # pragma: allowlist secret
10+
MODEL_BASE=gpt-3.5-turbo
11+
MODEL_TEST=gpt-4o-mini
12+
13+
# backend configuration
14+
API_URL=http://backend:8000 # for local API_URL= http://loaclhost:8000
15+
HOST=0.0.0.0
16+
PORT=3000

services/retriever/src/config.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,15 @@ class Settings(BaseSettings):
1919
host: str = Field(..., alias="HOST")
2020
port: int = Field(..., alias="PORT")
2121

22-
class Config:
23-
env_file = ".env"
24-
env_file_encoding = "utf-8"
25-
case_sensitive = True
22+
from pydantic_settings import SettingsConfigDict
2623

24+
class Settings(BaseSettings):
25+
# ... fields ...
26+
27+
model_config = SettingsConfigDict(
28+
env_file=".env",
29+
env_file_encoding="utf-8",
30+
case_sensitive=True,
31+
)
2732

2833
settings = Settings()

services/scraper/.dockerignore

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1 @@
1-
.venv
2-
.venv/*
31
.venv/

services/scraper/db_parser/config.py

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,33 @@
11
from pydantic_settings import BaseSettings, SettingsConfigDict
22

33

4-
class db_parser_settings(BaseSettings):
4+
# services/scraper/db_parser/config.py
5+
6+
from pydantic import BaseSettings
7+
8+
class DbParserSettings(BaseSettings):
9+
# … (other settings fields)
510

11+
# … (any other module‐level code)
12+
13+
# Replace instantiation to match the new class name
14+
settings = DbParserSettings()
615
POSTGRES_URL: str
716

817
model_config = SettingsConfigDict(
9-
env_file="../../.env",
18+
from pathlib import Path
19+
20+
PROJECT_ROOT = Path(__file__).parent.parent.parent
21+
22+
class db_parser_settings(BaseSettings):
23+
POSTGRES_URL: str
24+
25+
model_config = SettingsConfigDict(
26+
env_file=str(PROJECT_ROOT / ".env"),
1027
case_sensitive=False,
1128
extra="ignore",
29+
) case_sensitive=False,
30+
extra="ignore",
1231
)
1332

1433
def __init__(self, **kwargs):

0 commit comments

Comments
 (0)