PROPPR uses centralized credential management through environment variables. All sensitive credentials are loaded from .env files in development and system environment variables in production.
The platform automatically detects the environment (production on Linux, development on macOS) and loads appropriate credentials.
def is_production() -> bool: """Check if running in production (Linux/Hetzner server).""" return platform.system() == "Linux"def is_development() -> bool: """Check if running in development (Mac).""" return not is_production()
from PROPPR.config import get_telegram_token# Get token for specific botteam_token = get_telegram_token('team') # Required by defaultplayer_token = get_telegram_token('player', required=True)# Optional tokentest_token = get_telegram_token('ev', required=False) # Returns None if not set
Bot tokens are sensitive. Never commit them to version control. Use .env files that are in .gitignore.
# Primary keyODDS_API_KEY=your_primary_api_key_here# Backup keys for specific bookmakersODDS_API_KEY_BACKUP_1=fbsports_api_key_hereODDS_API_KEY_BACKUP_2=bet365_api_key_here
from PROPPR.config import get_channel_id, get_admin_user_id# Get channel IDs (returns int or None)sub_channel = get_channel_id('subscription_arb')horse_beta = get_channel_id('horse_beta')freeze_channel = get_channel_id('freeze')player_invite = get_channel_id('player_invite')# Get admin user IDadmin_id = get_admin_user_id() # Returns: 123456789
from PROPPR.config import ( get_overtime_api_key, get_overtime_wallet_key, get_overtime_rpc_url, get_overtime_referrer_id)api_key = get_overtime_api_key()wallet_key = get_overtime_wallet_key() # For encrypting user private keysrpc_url = get_overtime_rpc_url() # Defaults to public RPC if not setreferrer = get_overtime_referrer_id() # Defaults to 'Proppr'
from PROPPR.config import validate_required_credentials# Validate all required credentials for a botresult = validate_required_credentials('player')if not result['valid']: print(f"Missing credentials: {result['missing']}") # Output: ['MONGODB_URI_*', 'TELEGRAM_TOKEN_PLAYER_BOT', 'ODDS_API_KEY']
from PROPPR.config import print_credential_status# Print full status reportprint_credential_status()
Sample Output
=== PROPPR Credential Status ===Environment: PRODUCTIONMongoDB: URI: SET Database: CerebroTelegram Tokens: team: SET (12345678...) player: SET (87654321...) arb: SET (11223344...) horse: NOT SET ev: SET (55667788...) overtime: SET (99887766...) freeze: NOT SETAPI Keys: Odds API: SET FootyStats: SET SportMonks: NOT SETGoogle Sheets: player: SET team: SET horses: NOT SET cerebro: SET
try: token = get_telegram_token('invalid_bot')except ValueError as e: print(f"Error: {e}") # Output: Invalid bot name 'invalid_bot'. Must be one of: team, player, arb, ...