first commit
This commit is contained in:
@@ -0,0 +1,49 @@
|
||||
import os
|
||||
from typing import Optional
|
||||
|
||||
|
||||
class Config:
|
||||
"""Application configuration management."""
|
||||
|
||||
# API Configuration
|
||||
API_URL: str = "https://api.kleer.se/v1"
|
||||
DEFAULT_COMPANY_ID: str = "1336"
|
||||
API_KEY : str = "rjAXm8PM70kqTUt" # To be set via environment variable
|
||||
|
||||
# Date Formats
|
||||
CSV_DATE_FORMAT: str = '%m/%d/%Y'
|
||||
API_DATE_FORMAT: str = '%Y-%m-%d'
|
||||
XLSX_SHEET_NAME: str = "AGRESSO"
|
||||
|
||||
# CSV Column Indices
|
||||
DATE_COL_INDEX: int = 5
|
||||
HOURS_COL_INDEX: int = 10
|
||||
|
||||
# Business Rules
|
||||
MIN_HOURS_THRESHOLD: float = 0.2
|
||||
|
||||
# Server Configuration
|
||||
SERVER_HOST: str = "0.0.0.0"
|
||||
SERVER_PORT: int = 8000
|
||||
|
||||
# Environment Variables
|
||||
@staticmethod
|
||||
def get_api_key() -> Optional[str]:
|
||||
"""Get Kleer API key from environment."""
|
||||
return os.getenv('KLEER_API_KEY',Config.API_KEY)
|
||||
|
||||
@staticmethod
|
||||
def get_username() -> str:
|
||||
"""Get username from environment with fallback."""
|
||||
return os.getenv('KLEER_USERNAME', 'Christopher Juhlin')
|
||||
|
||||
@staticmethod
|
||||
def get_company_id() -> str:
|
||||
"""Get company ID from environment with fallback."""
|
||||
return os.getenv('KLEER_COMPANY_ID', Config.DEFAULT_COMPANY_ID)
|
||||
|
||||
@staticmethod
|
||||
def validate_config() -> None:
|
||||
"""Validate required configuration is present."""
|
||||
if not Config.get_api_key():
|
||||
raise ValueError("KLEER_API_KEY environment variable is not set")
|
||||
Reference in New Issue
Block a user