def create_app() -> Flagon: app = Flagon(__name__) app.config['SECRET_KEY'] = 'notsosecret' app.cors = CORS(app) app.db = create_database( dbname=os.environ["DB_NAME"], host=os.environ["DB_HOST"], password=os.environ["DB_PASSWORD"], port=os.environ["DB_PORT"], user=os.environ["DB_USER"], ) app.device_location_tag_store = DeviceLocationTagStore(db=app.db) app.device_type_metric_store = DeviceTypeMetricStore(db=app.db) app.location_tag_store = LocationTagStore(db=app.db) app.metric_store = MetricStore(db=app.db) app.device_type_store = DeviceTypeStore( db=app.db, device_type_metric_store=app.device_type_metric_store, metric_store=app.metric_store) app.device_store = DeviceStore( db=app.db, device_location_tag_store=app.device_location_tag_store, location_tag_store=app.location_tag_store, device_type_store=app.device_type_store, ) app.report_store = ReportStore( db=app.db, device_store=app.device_store, device_type_metric_store=app.device_type_metric_store, metric_store=app.metric_store, ) app.register_blueprint(DEVICE_LOCATION_TAGS_V0_BLUEPRINT, url_prefix="/v0") app.register_blueprint(DEVICE_TYPE_METRICS_V0_BLUEPRINT, url_prefix="/v0") app.register_blueprint(DEVICE_TYPES_V0_BLUEPRINT, url_prefix="/v0") app.register_blueprint(DEVICES_V0_BLUEPRINT, url_prefix="/v0") app.register_blueprint(LOCATION_TAGS_V0_BLUEPRINT, url_prefix="/v0") app.register_blueprint(METRICS_V0_BLUEPRINT, url_prefix="/v0") app.register_blueprint(REPORTS_V0_BLUEPRINT, url_prefix="/v0") return app
def create_app() -> Flagon: app = Flagon(__name__) app.cors = CORS(app) app.db = create_database( dbname=os.environ["DB_NAME"], host=os.environ["DB_HOST"], password=os.environ["DB_PASSWORD"], port=os.environ["DB_PORT"], user=os.environ["DB_USER"], ) app.user_store = UserStore(db=app.db) app.superuser_store = SuperuserStore(db=app.db) app.access_control_store = AccessControlStore(db=app.db) app.register_blueprint(USERS_V0_BLUEPRINT, url_prefix="/v0") app.register_blueprint(SUPERUSERS_V0_BLUEPRINT, url_prefix="/v0") app.register_blueprint(ACCESS_CONTROLS_V0_BLUEPRINT, url_prefix="/v0") return app