yeastar-voipms-webhook-proxy/app.py

31 lines
836 B
Python
Raw Normal View History

2025-07-13 22:10:11 -04:00
from flask import Flask
from routes import yeastar, voipms
import logging
2025-07-13 23:38:59 -04:00
import os
import shutil
2025-07-13 22:10:11 -04:00
import sys
2025-07-13 23:38:59 -04:00
# Check for config.py at runtime
if not os.path.exists("config.py"):
print("config.py not found <20> creating from config.template.py")
try:
shutil.copyfile("config.template.py", "config.py")
print("Created config.py <20> please edit it with your real secrets.")
sys.exit(1) # Exit so user must edit it manually
except Exception as e:
print(f"Failed to create config.py: {e}")
sys.exit(1)
2025-07-13 22:10:11 -04:00
# Disable Flask/Werkzeug noisy request log
log = logging.getLogger('werkzeug')
log.setLevel(logging.ERROR)
app = Flask(__name__)
# Register blueprints
app.register_blueprint(yeastar.bp)
app.register_blueprint(voipms.bp)
if __name__ == '__main__':
app.run(host='0.0.0.0', port=5000)