#!/bin/bash
# =============================================================================
# Script para criar Docker Secrets - QR Rapido PRODUÇÃO
# VALORES REAIS - NÃO COMPARTILHAR!
# =============================================================================
#
# Execute no servidor MANAGER do Docker Swarm (141.148.162.114):
#   chmod +x create-secrets-prod.sh
#   ./create-secrets-prod.sh
#
# =============================================================================

set -e

echo "=== Criando Docker Secrets para QR Rapido ==="

# Stripe
echo "Criando stripe_secret_key..."
echo -n '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' | docker secret create stripe_secret_key - || echo "Já existe"

echo "Criando stripe_webhook_secret..."
echo -n 'whsec_gYri7qNVHc18sREu2eXnjdRzklwRf3hI' | docker secret create stripe_webhook_secret - || echo "Já existe"

# MongoDB
echo "Criando mongodb_connection_string..."
echo -n 'mongodb://admin:c4rn31r0@129.146.116.218:27017,141.148.162.114:27017/QrRapido?replicaSet=rs0&authSource=admin' | docker secret create mongodb_connection_string - || echo "Já existe"

# Google OAuth
echo "Criando google_client_id..."
echo -n '1080447252222-dqjsu999tvrpb69oj5iapckdh9g8rvha.apps.googleusercontent.com' | docker secret create google_client_id - || echo "Já existe"

echo "Criando google_client_secret..."
echo -n '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' | docker secret create google_client_secret - || echo "Já existe"

# Microsoft OAuth
echo "Criando microsoft_client_id..."
echo -n '9bec3835-acdb-4c5a-8668-6b90955c6ad2' | docker secret create microsoft_client_id - || echo "Já existe"

echo "Criando microsoft_client_secret..."
echo -n 'Oe38Q~FsZ3X5ouptAB6oYyX7MXaGUvxXcqT.aaT9' | docker secret create microsoft_client_secret - || echo "Já existe"

echo ""
echo "=== Secrets criados! ==="
echo ""
docker secret ls

echo ""
echo "=== Próximos passos ==="
echo "1. Remova o service atual: docker service rm qrrapido-prod"
echo "2. Faça o deploy (CI/CD ou manual) para recriar com os secrets"
