From 90cd5d79988ea1119818114b224ba2a5c5552173 Mon Sep 17 00:00:00 2001 From: Ricardo Carneiro Date: Mon, 30 Mar 2026 19:58:57 -0300 Subject: [PATCH] fix: rapidapi key --- .github/workflows/deploy.yml | 17 +++++++++++++++++ appsettings.json | 2 +- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 0dd55b5..116308b 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -180,9 +180,25 @@ jobs: docker secret ls | grep -q "microsoft_client_id" || echo "AVISO: Secret microsoft_client_id não existe!" docker secret ls | grep -q "microsoft_client_secret" || echo "AVISO: Secret microsoft_client_secret não existe!" + # Cria secret do RapidAPI automaticamente se não existir + echo "Gerenciando secret rapidapi_proxy_secret..." + if ! docker secret inspect rapidapi_proxy_secret > /dev/null 2>&1; then + printf '%s' '${{ secrets.RAPIDAPI_PROXY_SECRET }}' | docker secret create rapidapi_proxy_secret - + echo "Secret rapidapi_proxy_secret criado." + else + echo "Secret rapidapi_proxy_secret já existe." + fi + # Verifica se o service existe if docker service inspect qrrapido-prod > /dev/null 2>&1; then echo "Service existe, atualizando imagem..." + + # Migração: adiciona o secret ao service se ainda não estiver configurado + if ! docker service inspect qrrapido-prod --format '{{range .Spec.TaskTemplate.ContainerSpec.Secrets}}{{.SecretName}} {{end}}' | grep -q "rapidapi_proxy_secret"; then + echo "Adicionando rapidapi_proxy_secret ao service existente..." + docker service update --secret-add rapidapi_proxy_secret --update-order start-first qrrapido-prod + fi + docker service update \ --image ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest \ --env-add Serilog__OpenSearchUrl="http://141.148.162.114:19201" \ @@ -208,6 +224,7 @@ jobs: --secret google_client_secret \ --secret microsoft_client_id \ --secret microsoft_client_secret \ + --secret rapidapi_proxy_secret \ --env ASPNETCORE_ENVIRONMENT=Production \ --env ASPNETCORE_URLS=http://+:8080 \ --env Serilog__OpenSearchUrl="http://141.148.162.114:19201" \ diff --git a/appsettings.json b/appsettings.json index a7cca69..3fbfa64 100644 --- a/appsettings.json +++ b/appsettings.json @@ -189,7 +189,7 @@ } }, "RapidApi": { - "ProxySecret": "" + "ProxySecret": "c9a7c750-2c39-11f1-9fe6-59a87b6d6ae1" }, "AllowedHosts": "*" } \ No newline at end of file