feat(api): Update API to use skill-seekers-configs repository

- Update render.yaml to clone skill-seekers-configs during build
- Update main.py to use configs_repo/official directory
- Add fallback to local configs/ for development
- Update config_analyzer to scan subdirectories recursively
- Update download endpoint to search in subdirectories
- Add configs_repository link to API root
- Add configs_repo/ to .gitignore

This separates config storage from main repo to prevent bloating.
Configs now live at: https://github.com/yusufkaraaslan/skill-seekers-configs
This commit is contained in:
yusyus
2025-12-21 14:26:03 +03:00
parent 3c8603e6b7
commit 5ba4a36906
4 changed files with 19 additions and 6 deletions

1
api/.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
configs_repo/

View File

@@ -76,8 +76,8 @@ class ConfigAnalyzer:
""" """
configs = [] configs = []
# Find all JSON files in configs directory # Find all JSON files recursively in configs directory and subdirectories
for config_file in sorted(self.config_dir.glob("*.json")): for config_file in sorted(self.config_dir.rglob("*.json")):
try: try:
metadata = self.analyze_config(config_file) metadata = self.analyze_config(config_file)
if metadata: # Skip invalid configs if metadata: # Skip invalid configs

View File

@@ -31,7 +31,11 @@ app.add_middleware(
) )
# Initialize config analyzer # Initialize config analyzer
CONFIG_DIR = Path(__file__).parent.parent / "configs" # Try configs_repo first (production), fallback to configs (local development)
CONFIG_DIR = Path(__file__).parent / "configs_repo" / "official"
if not CONFIG_DIR.exists():
CONFIG_DIR = Path(__file__).parent.parent / "configs"
analyzer = ConfigAnalyzer(CONFIG_DIR) analyzer = ConfigAnalyzer(CONFIG_DIR)
@@ -45,9 +49,11 @@ async def root():
"/api/configs": "List all available configs", "/api/configs": "List all available configs",
"/api/configs/{name}": "Get specific config details", "/api/configs/{name}": "Get specific config details",
"/api/categories": "List all categories", "/api/categories": "List all categories",
"/api/download/{name}": "Download config file",
"/docs": "API documentation", "/docs": "API documentation",
}, },
"repository": "https://github.com/yusufkaraaslan/Skill_Seekers", "repository": "https://github.com/yusufkaraaslan/Skill_Seekers",
"configs_repository": "https://github.com/yusufkaraaslan/skill-seekers-configs",
"website": "https://api.skillseekersweb.com" "website": "https://api.skillseekersweb.com"
} }
@@ -178,9 +184,13 @@ async def download_config(config_name: str):
if not config_name.endswith(".json"): if not config_name.endswith(".json"):
config_name = f"{config_name}.json" config_name = f"{config_name}.json"
config_path = CONFIG_DIR / config_name # Search recursively in all subdirectories
config_path = None
for found_path in CONFIG_DIR.rglob(config_name):
config_path = found_path
break
if not config_path.exists(): if not config_path or not config_path.exists():
raise HTTPException( raise HTTPException(
status_code=404, status_code=404,
detail=f"Config file '{config_name}' not found" detail=f"Config file '{config_name}' not found"

View File

@@ -4,7 +4,9 @@ services:
name: skill-seekers-api name: skill-seekers-api
runtime: python runtime: python
plan: free plan: free
buildCommand: pip install -r api/requirements.txt buildCommand: |
pip install -r api/requirements.txt &&
git clone https://github.com/yusufkaraaslan/skill-seekers-configs.git api/configs_repo
startCommand: cd api && uvicorn main:app --host 0.0.0.0 --port $PORT startCommand: cd api && uvicorn main:app --host 0.0.0.0 --port $PORT
envVars: envVars:
- key: PYTHON_VERSION - key: PYTHON_VERSION