34 lines
702 B
Python
34 lines
702 B
Python
|
|
"""Configuration management for data collection module."""
|
||
|
|
from pathlib import Path
|
||
|
|
from pydantic_settings import BaseSettings
|
||
|
|
|
||
|
|
|
||
|
|
class Config(BaseSettings):
|
||
|
|
"""Application configuration loaded from environment variables."""
|
||
|
|
|
||
|
|
# Tushare API token
|
||
|
|
tushare_token: str = ""
|
||
|
|
|
||
|
|
# Data storage path
|
||
|
|
data_path: Path = Path("./data")
|
||
|
|
|
||
|
|
# Rate limit: requests per minute
|
||
|
|
rate_limit: int = 100
|
||
|
|
|
||
|
|
# Thread pool size
|
||
|
|
threads: int = 2
|
||
|
|
|
||
|
|
class Config:
|
||
|
|
env_file = ".env.local"
|
||
|
|
env_file_encoding = "utf-8"
|
||
|
|
case_sensitive = False
|
||
|
|
|
||
|
|
|
||
|
|
# Global config instance
|
||
|
|
config = Config()
|
||
|
|
|
||
|
|
|
||
|
|
def get_config() -> Config:
|
||
|
|
"""Get configuration instance."""
|
||
|
|
return config
|