Create and configure the Keeper Commander Service.
()
| 19 | |
| 20 | |
| 21 | def create_app(): |
| 22 | """Create and configure the Keeper Commander Service.""" |
| 23 | logger.debug("Initializing Keeper Commander Service") |
| 24 | |
| 25 | log = logging.getLogger('werkzeug') |
| 26 | log.setLevel(logging.ERROR) |
| 27 | log.addFilter(SSLHandshakeFilter()) |
| 28 | |
| 29 | app = Flask(__name__) |
| 30 | |
| 31 | if is_behind_proxy(): |
| 32 | app.wsgi_app = ProxyFix(app.wsgi_app, x_for=1, x_proto=1, x_host=1, x_prefix=1) |
| 33 | |
| 34 | try: |
| 35 | logger.debug("Configuring rate limiter") |
| 36 | limiter.init_app(app) |
| 37 | |
| 38 | logger.debug("Initializing API routes") |
| 39 | init_routes(app) |
| 40 | |
| 41 | print("Keeper Commander Service initialization complete") |
| 42 | return app |
| 43 | |
| 44 | except Exception as e: |
| 45 | logger.error(f"Failed to initialize Keeper Commander Service: {str(e)}") |
| 46 | raise |
no test coverage detected