backend/web_server.py) supports configuration through environment variables, allowing you to customize the host, port, and debug mode without modifying code.
Available Variables
The following environment variables are supported:The network interface to bind the Flask server to.
- Use
localhostor127.0.0.1for local-only access - Use
0.0.0.0to accept connections from any network interface
The port number for the Flask web server.
- Default is
5000 - Use a different port if 5000 is already in use
- Must be between 1024 and 65535 for non-privileged users
Enable or disable Flask debug mode.
trueorTrueenables debug mode (automatic reloading, detailed errors)falseorFalsedisables debug mode (recommended for production)
Implementation Details
The Flask server reads these variables during startup:web_server.py:184-186
The
DEBUG variable performs a case-insensitive string comparison. Any value that doesn’t equal “true” (case-insensitive) will be treated as False.Setting Environment Variables
- macOS/Linux
- Windows (PowerShell)
- Windows (CMD)
Common Configurations
Development (Default)
For local development with hot-reloading:Network Access
To allow connections from other devices on your network:http://localhost:5000(local machine)http://<your-ip>:5000(other devices on the network)
Production-like
For testing in production-like conditions:Flask’s built-in server is not recommended for production deployments. For production, use a WSGI server like Gunicorn or uWSGI.
Custom Port
If port 5000 is occupied (common on macOS where AirPlay uses port 5000):Using with Automated Scripts
The automated run scripts (run.sh and run.ps1) don’t currently pass environment variables to the servers. To use custom configurations with the automated scripts, you can:
Option 1: Modify the Scripts
Edit the run script to include environment variables:Option 2: Export Before Running
Export variables in your current shell session before running the script:- macOS/Linux
- Windows (PowerShell)
Verifying Configuration
When the Flask server starts, it prints the configuration:Connection String Format
The Flask server connects to the ICE server using a hardcoded connection string:web_server.py:37-39
The ICE server port (10000) is not configurable via environment variables. It’s hardcoded in both the server and client connection strings.
Next Steps
Local Setup
Learn how to run the application locally
ngrok Tunnel
Expose your server to the internet