Files
ax_hub_mcp_tool/cleanup.py
jade 4015207b86
All checks were successful
Deploy to OCIWP / deploy (push) Successful in 7m53s
fix: map Nginx 8281 to host 8080 to restore Apache proxy connection
2026-07-24 23:52:55 +09:00

41 lines
1.6 KiB
Python

import re
# 1. Clean docker-compose.yml
with open('docker-compose.yml', 'r', encoding='utf-8') as f:
content = f.read()
# Remove tool-email and tool-payment blocks
content = re.sub(r'^\s*tool-(email|payment)-(blue|green):.*?^\s*- SPRING_PROFILES_ACTIVE=\$\{ACTIVE_PROFILE:-local\}\n\n?', '', content, flags=re.MULTILINE | re.DOTALL)
# Remove MCP fallback routes
content = re.sub(r'^\s*- MCP_GATEWAY_FALLBACK_ROUTES_(EMAIL|PAYMENT)=.*?\n', '', content, flags=re.MULTILINE)
with open('docker-compose.yml', 'w', encoding='utf-8') as f:
f.write(content)
# 2. Clean deploy.yml
with open('.gitea/workflows/deploy.yml', 'r', encoding='utf-8') as f:
lines = f.readlines()
new_lines = []
for line in lines:
if 'tool-email' in line or 'tool-payment' in line:
# For lines that have multiple tools (like docker compose stop), just remove the specific ones
if 'docker compose stop' in line:
line = re.sub(r' tool-(email|payment)-\$[A-Z_]+', '', line)
new_lines.append(line)
else:
new_lines.append(line)
with open('.gitea/workflows/deploy.yml', 'w', encoding='utf-8') as f:
f.writelines(new_lines)
# 3. Clean nginx/conf.d/default.conf
with open('nginx/conf.d/default.conf', 'r', encoding='utf-8') as f:
content = f.read()
content = re.sub(r'upstream tool-(email|payment) \{.*?\n\}\n\n?', '', content, flags=re.MULTILINE | re.DOTALL)
content = re.sub(r'server \{\n\s+listen 828[35];.*?\n\}\n\n?', '', content, flags=re.MULTILINE | re.DOTALL)
with open('nginx/conf.d/default.conf', 'w', encoding='utf-8') as f:
f.write(content)