MCPcopy Create free account
hub / github.com/Keeper-Security/Commander / create_app

Function create_app

keepercommander/service/app.py:24–59  ·  view source on GitHub ↗

Create and configure the Keeper Commander Service.

()

Source from the content-addressed store, hash-verified

22
23
24def create_app():
25 """Create and configure the Keeper Commander Service."""
26 logger.debug("Initializing Keeper Commander Service")
27
28 log = logging.getLogger('werkzeug')
29 log.setLevel(logging.ERROR)
30 log.addFilter(SSLHandshakeFilter())
31
32 app = Flask(__name__)
33
34 if is_behind_proxy():
35 app.wsgi_app = ProxyFix(app.wsgi_app, x_for=1, x_proto=1, x_host=1, x_prefix=1)
36
37 try:
38 logger.debug("Configuring rate limiter")
39 limiter.init_app(app)
40
41 @app.errorhandler(RateLimitExceeded)
42 def handle_rate_limit_exceeded(e):
43 detail = getattr(e, 'description', None) or str(e)
44 body, status = rate_limited_response(detail)
45 return jsonify(body), status
46
47 logger.debug("Initializing API routes")
48 init_routes(app)
49
50 if (os.environ.get('SAILPOINT_RECORD') or '').strip():
51 from .commands.integrations.sailpoint.service import SailPointService
52 SailPointService.start_background_services()
53
54 print("Keeper Commander Service initialization complete")
55 return app
56
57 except Exception as e:
58 logger.error(f"Failed to initialize Keeper Commander Service: {str(e)}")
59 raise

Callers 3

service_app.pyFile · 0.85
start_serviceMethod · 0.85

Calls 7

is_behind_proxyFunction · 0.85
init_routesFunction · 0.85
getMethod · 0.80
SSLHandshakeFilterClass · 0.50
debugMethod · 0.45
errorMethod · 0.45

Tested by 1