#!/usr/bin/env python3
"""Integrate security routes into api_proxy.py"""
# Read existing api_proxy.py
with open('app/routes/api_proxy.py', 'r') as f:
content = f.read()
# Read security routes
with open('security_routes_addition.py', 'r') as f:
security_routes = f.read()
# Find insertion point - between company-settings and plans routes
company_settings_end = "return jsonify({'success': True, 'message': 'Company settings updated'})"
plans_route = "@api_proxy_bp.route('/api/plans'"
if company_settings_end in content and plans_route in content:
# Find position of plans route
pos = content.index(plans_route)
content = content[:pos] + '\n\n' + security_routes + '\n\n' + content[pos:]
with open('app/routes/api_proxy.py', 'w') as f:
f.write(content)
print('SUCCESS: Security routes integrated')
else:
print('ERROR: Could not find markers')