initializare
This commit is contained in:
58
config.py
Normal file
58
config.py
Normal file
@@ -0,0 +1,58 @@
|
||||
"""
|
||||
Configurare pentru BTGO Scraper
|
||||
Citeste configuratii din variabile de mediu (.env)
|
||||
"""
|
||||
from dotenv import load_dotenv
|
||||
import os
|
||||
|
||||
# Incarca variabilele de mediu din fisierul .env
|
||||
load_dotenv()
|
||||
|
||||
|
||||
class Config:
|
||||
"""Clasa pentru gestionarea configuratiilor aplicatiei"""
|
||||
|
||||
# Credentials
|
||||
BTGO_USERNAME = os.getenv('BTGO_USERNAME')
|
||||
BTGO_PASSWORD = os.getenv('BTGO_PASSWORD')
|
||||
|
||||
# Browser settings
|
||||
HEADLESS = os.getenv('HEADLESS', 'false').lower() == 'true'
|
||||
|
||||
# Timeouts
|
||||
TIMEOUT_2FA_SECONDS = int(os.getenv('TIMEOUT_2FA_SECONDS', 120))
|
||||
|
||||
# Paths
|
||||
OUTPUT_DIR = os.getenv('OUTPUT_DIR', './data')
|
||||
LOG_DIR = './logs'
|
||||
|
||||
# Features
|
||||
SCREENSHOT_ON_ERROR = os.getenv('SCREENSHOT_ON_ERROR', 'true').lower() == 'true'
|
||||
DOWNLOAD_TRANSACTIONS = os.getenv('DOWNLOAD_TRANSACTIONS', 'true').lower() == 'true'
|
||||
LOG_LEVEL = os.getenv('LOG_LEVEL', 'INFO')
|
||||
|
||||
# Notification settings
|
||||
ENABLE_NOTIFICATIONS = os.getenv('ENABLE_NOTIFICATIONS', 'false').lower() == 'true'
|
||||
|
||||
# Email settings (SMTP)
|
||||
EMAIL_ENABLED = os.getenv('EMAIL_ENABLED', 'false').lower() == 'true'
|
||||
SMTP_SERVER = os.getenv('SMTP_SERVER')
|
||||
SMTP_PORT = int(os.getenv('SMTP_PORT', 587))
|
||||
SMTP_USERNAME = os.getenv('SMTP_USERNAME')
|
||||
SMTP_PASSWORD = os.getenv('SMTP_PASSWORD')
|
||||
EMAIL_FROM = os.getenv('EMAIL_FROM')
|
||||
EMAIL_TO = os.getenv('EMAIL_TO')
|
||||
|
||||
# Telegram settings
|
||||
TELEGRAM_ENABLED = os.getenv('TELEGRAM_ENABLED', 'false').lower() == 'true'
|
||||
TELEGRAM_BOT_TOKEN = os.getenv('TELEGRAM_BOT_TOKEN')
|
||||
TELEGRAM_CHAT_ID = os.getenv('TELEGRAM_CHAT_ID')
|
||||
|
||||
@classmethod
|
||||
def validate(cls):
|
||||
"""Valideaza ca toate configuratiile obligatorii sunt setate"""
|
||||
if not cls.BTGO_USERNAME or not cls.BTGO_PASSWORD:
|
||||
raise ValueError("BTGO_USERNAME si BTGO_PASSWORD trebuie setate in .env")
|
||||
|
||||
if cls.TIMEOUT_2FA_SECONDS < 30:
|
||||
raise ValueError("TIMEOUT_2FA_SECONDS trebuie sa fie minim 30 secunde")
|
||||
Reference in New Issue
Block a user