import re

# Читаем файл
with open('api/server.py', 'r') as f:
    content = f.read()

# Обновляем DB_CONFIG
new_config = """DB_CONFIG = {
    'host': '127.0.0.1',
    'database': 'aliexpress_automation',
    'user': 'postgres',
    'password': 'PostgresPass123'
}"""

# Ищем и заменяем DB_CONFIG
pattern = r'DB_CONFIG\s*=\s*{[^}]*}'
content = re.sub(pattern, new_config, content, flags=re.MULTILINE | re.DOTALL)

# Записываем обратно
with open('api/server.py', 'w') as f:
    f.write(content)

print("✅ Конфигурация API обновлена")
