diff --git a/app/cm_web_view.py b/app/cm_web_view.py index 9020b78..509d7e5 100644 --- a/app/cm_web_view.py +++ b/app/cm_web_view.py @@ -13,6 +13,16 @@ PREFIX_PATTERN = os.getenv('CM_PREFIX_PATTERN', '') print("API: ", API_BASE_URL) print("Prefix pattern: ", PREFIX_PATTERN) + +def _debug_enabled() -> bool: + """Return True iff CM_DEBUG env var is set to a truthy value. + + Truthy: '1', 'true', 'yes' (case-insensitive, whitespace-trimmed). + Anything else, including unset, is False. Default-off so the + Werkzeug debugger is never reachable in production containers. + """ + return os.getenv("CM_DEBUG", "false").strip().lower() in ("1", "true", "yes") + # Beautiful HTML template with modern styling HTML_TEMPLATE = """ @@ -745,4 +755,4 @@ if __name__ == '__main__': print("Starting CM Web View...") print("Web interface will be available at: http://localhost:8000") print("Make sure the API server is running on port 3000") - app.run(host='0.0.0.0', port=8000, debug=True) + app.run(host='0.0.0.0', port=8000, debug=_debug_enabled())