This guide explains how to test the User Config API server manually.
- Install the API server dependencies:
cd user_config_api pip install -r requirements.txt
cd user_config_api
uvicorn server:app --host 0.0.0.0 --port 8080curl http://localhost:8080/healthExpected output:
{"status":"ok"}curl -H "Authorization: Bearer your-secret-api-key-here" \
http://localhost:8080/config/github/notfolder | python -m json.toolExpected output:
{
"status": "success",
"data": {
"llm": {
"provider": "openai",
...
},
"system_prompt": "...",
"max_llm_process_num": 1000
}
}curl http://localhost:8080/config/github/notfolderExpected output (401 Unauthorized):
{
"detail": "認証に失敗しました"
}curl -H "Authorization: Bearer wrong-key" \
http://localhost:8080/config/github/notfolderExpected output (401 Unauthorized):
{
"detail": "認証に失敗しました"
}Create a test script:
import os
import requests
import yaml
# Set environment variables
os.environ["TASK_SOURCE"] = "github"
os.environ["USER_CONFIG_API_URL"] = "http://localhost:8080"
os.environ["USER_CONFIG_API_KEY"] = "your-secret-api-key-here"
os.environ["USE_USER_CONFIG_API"] = "true"
# Test config loading
# (This would require importing main.py with all dependencies installed)docker-compose up --build user-config-api# From another container in the same network
curl http://user-config-api:8080/healthAPI_SERVER_KEY: API key for authentication (overrides config.yaml)USE_USER_CONFIG_API: Set to "true" to enable API-based config loading in main.pyUSER_CONFIG_API_URL: URL of the API server (default: http://user-config-api:8080)USER_CONFIG_API_KEY: API key for accessing the config API
All tests passed successfully:
- ✓ Health check endpoint (no auth required)
- ✓ Config endpoint with correct Bearer token (200 OK)
- ✓ Config endpoint without authentication (401 Unauthorized)
- ✓ Config endpoint with wrong Bearer token (401 Unauthorized)
- ✓ Integration test with _fetch_config_from_api function