feat(web): make Werkzeug debug opt-in via CM_DEBUG
This commit is contained in:
parent
34f5398bff
commit
7cea119ad7
@ -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 = """
|
||||
<!DOCTYPE html>
|
||||
@ -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())
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user