Support read replicas

This commit is contained in:
Curtis Castrapel 2019-05-28 12:45:39 -07:00
parent 5059cb731a
commit fd35a26955
1 changed files with 7 additions and 0 deletions

View File

@ -19,6 +19,7 @@ from logging import Formatter, StreamHandler
from logging.handlers import RotatingFileHandler from logging.handlers import RotatingFileHandler
from flask import Flask from flask import Flask
from flask_replicated import FlaskReplicated
import logmatic import logmatic
from lemur.certificates.hooks import activate_debug_dump from lemur.certificates.hooks import activate_debug_dump
@ -53,6 +54,7 @@ def create_app(app_name=None, blueprints=None, config=None):
configure_blueprints(app, blueprints) configure_blueprints(app, blueprints)
configure_extensions(app) configure_extensions(app)
configure_logging(app) configure_logging(app)
configure_database(app)
install_plugins(app) install_plugins(app)
@app.teardown_appcontext @app.teardown_appcontext
@ -158,6 +160,11 @@ def configure_blueprints(app, blueprints):
app.register_blueprint(blueprint, url_prefix="/api/{0}".format(API_VERSION)) app.register_blueprint(blueprint, url_prefix="/api/{0}".format(API_VERSION))
def configure_database(app):
if app.config.get("SQLALCHEMY_ENABLE_FLASK_REPLICATED"):
FlaskReplicated(app)
def configure_logging(app): def configure_logging(app):
""" """
Sets up application wide logging. Sets up application wide logging.