This commit is contained in:
@@ -6,6 +6,7 @@ import sentry_sdk
|
||||
from sentry_sdk.integrations.flask import FlaskIntegration
|
||||
from sentry_sdk.integrations.logging import LoggingIntegration
|
||||
from sentry_sdk.integrations.sqlalchemy import SqlalchemyIntegration
|
||||
from healthcheck import HealthCheck
|
||||
|
||||
from resources import *
|
||||
from config import *
|
||||
@@ -14,6 +15,7 @@ from marshm import ma
|
||||
from mqtt_flask_instance import mqtt
|
||||
|
||||
from mqtt_methods import handle_status_message
|
||||
from healthchecks import health_database_status
|
||||
|
||||
"""
|
||||
Main Flask RESTful API
|
||||
@@ -53,6 +55,7 @@ api = Api(app)
|
||||
db.init_app(app)
|
||||
ma.init_app(app)
|
||||
mqtt.init_app(app)
|
||||
health = HealthCheck(app, "/healthz")
|
||||
|
||||
with app.app_context():
|
||||
db.create_all()
|
||||
@@ -98,6 +101,8 @@ api.add_resource(SensorResource, "/devices/{deviceid}/{sensorid}")
|
||||
api.add_resource(SensorOfflineResource, "/devices/{deviceid}/{sensorid}/offline")
|
||||
api.add_resource(SensorOnlineResource, "/devices/{deviceid}/{sensorid}/online")
|
||||
|
||||
health.add_check(health_database_status)
|
||||
|
||||
if __name__ == "__main__":
|
||||
app.run(
|
||||
debug=bool(DEBUG),
|
||||
|
||||
Reference in New Issue
Block a user