File size: 651 Bytes
4beb1ef
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import os
import logging
from dotenv import load_dotenv

logger = logging.getLogger(__name__)

# Load environment variables from .env file if it exists
load_dotenv()

def get_config():
    """
    Load configuration from environment variables
    """
    config = {
        # Server settings
        'HOST': os.getenv('HOST', '0.0.0.0'),
        'PORT': os.getenv('PORT', '7860'),
        'SHARE': os.getenv('SHARE', 'false').lower() == 'true',
        
        # Logging
        'LOG_LEVEL': os.getenv('LOG_LEVEL', 'INFO')
    }
    
    # Set logging level
    logging.basicConfig(level=getattr(logging, config['LOG_LEVEL']))
    
    return config