Skip to content

Commit 698ba4b

Browse files
committed
auth logfire inside docker container
1 parent 1554a20 commit 698ba4b

3 files changed

Lines changed: 36 additions & 4 deletions

File tree

docker-compose.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
version: '3.8'
2-
31
services:
42
codewiki:
53
image: codewiki:0.0.1
@@ -20,7 +18,7 @@ services:
2018
# Persistent storage for cache and output
2119
- ./output:/app/output
2220
# Git credentials (if needed for private repos)
23-
- ~/.gitconfig:/root/.gitconfig:ro
21+
# - ~/.gitconfig:/root/.gitconfig:ro
2422
- ~/.ssh:/root/.ssh:ro
2523
restart: unless-stopped
2624
healthcheck:

env.example

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,17 @@ LLM_API_KEY = sk-1234
1717
# Port for the main web application
1818
APP_PORT=8000
1919

20+
21+
# =============================================================================
22+
# Logfire Configuration
23+
# =============================================================================
24+
25+
# Logfire authentication token (get from ~/.logfire/default.toml after running 'logfire auth')
26+
LOGFIRE_TOKEN=
27+
28+
# Optional: Logfire project name (defaults to auto-detection)
29+
LOGFIRE_PROJECT_NAME=codewiki
30+
31+
# Optional: Logfire service name
32+
LOGFIRE_SERVICE_NAME=codewiki
33+

src/agent_orchestrator.py

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,28 @@
99
logger = logging.getLogger(__name__)
1010

1111
try:
12-
logfire.configure()
12+
# Configure logfire with environment variables for Docker compatibility
13+
logfire_token = os.getenv('LOGFIRE_TOKEN')
14+
logfire_project = os.getenv('LOGFIRE_PROJECT_NAME', 'default')
15+
logfire_service = os.getenv('LOGFIRE_SERVICE_NAME', 'default')
16+
17+
if logfire_token:
18+
# Configure with explicit token (for Docker)
19+
logfire.configure(
20+
token=logfire_token,
21+
project_name=logfire_project,
22+
service_name=logfire_service,
23+
)
24+
else:
25+
# Use default configuration (for local development with logfire auth)
26+
logfire.configure(
27+
project_name=logfire_project,
28+
service_name=logfire_service,
29+
)
30+
1331
logfire.instrument_pydantic_ai()
32+
logger.info(f"Logfire configured successfully for project: {logfire_project}")
33+
1434
except Exception as e:
1535
logger.warning(f"Failed to configure logfire: {e}")
1636

0 commit comments

Comments
 (0)