Add .env file support for UI client configuration
- Use python-dotenv to load environment variables - Add CONTROL_SERVER_URI environment variable for WebSocket connection - Create .env.example with configuration examples - Update Pipfile to include python-dotenv dependency - Allows easy configuration for running UI on desktop pointing to Pi
This commit is contained in:
@@ -15,10 +15,14 @@ import logging
|
||||
from async_tkinter_loop import async_handler, async_mainloop
|
||||
import websockets
|
||||
import websocket
|
||||
from dotenv import load_dotenv
|
||||
|
||||
# Load environment variables from .env file
|
||||
load_dotenv()
|
||||
|
||||
# Configuration
|
||||
CONFIG_FILE = "config.json"
|
||||
CONTROL_SERVER_URI = "ws://localhost:8765"
|
||||
CONTROL_SERVER_URI = os.getenv("CONTROL_SERVER_URI", "ws://localhost:8765")
|
||||
|
||||
# Dark theme colors
|
||||
bg_color = "#2e2e2e"
|
||||
|
Reference in New Issue
Block a user