Automated Action 3a29a346a9 Initial implementation of cryptocurrency data API service using CoinCap API
* Created FastAPI application structure
* Added database models for assets, exchanges, markets, and rates
* Integrated with CoinCap API
* Implemented REST API endpoints
* Setup SQLite persistence with Alembic migrations
* Added comprehensive documentation

Generated with BackendIM... (backend.im)
2025-05-14 12:18:27 +00:00

30 lines
901 B
Python

from pathlib import Path
from pydantic_settings import BaseSettings
class Settings(BaseSettings):
"""
Application settings loaded from environment variables
"""
API_V1_STR: str = "/api/v1"
PROJECT_NAME: str = "CryptoCurrency Data API Service"
# CoinCap API Settings
COINCAP_API_URL: str = "https://api.coincap.io/v3"
COINCAP_API_KEY: str = "b1afdeb4223dd63e8e26977c3539432eeaca0a7603c4655a7c9c57dadb40e7fe"
# Database Settings
DB_DIR: Path = Path("/app") / "storage" / "db"
SQLALCHEMY_DATABASE_URL: str = f"sqlite:///{DB_DIR}/db.sqlite"
# Redis Cache (optional)
# REDIS_URL: str = "redis://localhost:6379/0"
# CACHE_EXPIRATION: int = 300 # 5 minutes in seconds
class Config:
case_sensitive = True
settings = Settings()
# Ensure the database directory exists
settings.DB_DIR.mkdir(parents=True, exist_ok=True)