Retry 2239
	
		
			
	
		
	
	
		
	
		
			Some checks failed
		
		
	
	
		
			
				
	
				Optimized Build and Deploy / remote-build-and-deploy (push) Failing after 1m40s
				
			
		
		
	
	
				
					
				
			
		
			Some checks failed
		
		
	
	Optimized Build and Deploy / remote-build-and-deploy (push) Failing after 1m40s
				
			This commit is contained in:
		| @@ -58,16 +58,13 @@ jobs: | ||||
|             # 3. Despliegue con Docker Compose | ||||
|             cd /opt/gestion-integral | ||||
|             export DB_SA_PASSWORD='${{ secrets.DB_SA_PASSWORD_SECRET }}' | ||||
|             export JWT_KEY='${{ secrets.JWT_KEY }}' | ||||
|              | ||||
|             # --- PASO DE DEPURACIÓN --- | ||||
|             echo "Verificando variables de entorno..." | ||||
|             echo "Longitud de DB_SA_PASSWORD: ${#DB_SA_PASSWORD}" | ||||
|             echo "Longitud de JWT_KEY: ${#JWT_KEY}" | ||||
|             # ------------------------- | ||||
|             # Pasa el secreto de Gitea a un Docker Secret | ||||
|             # El comando "tr -d '\n'" elimina cualquier salto de línea final | ||||
|             printf "%s" "${{ secrets.JWT_KEY }}" | tr -d '\n' | docker secret create jwt_secret_key - || docker secret inspect jwt_secret_key > /dev/null | ||||
|              | ||||
|             echo "Recreando servicios..." | ||||
|             docker compose up -d --force-recreate | ||||
|             docker stack deploy -c /opt/gestion-integral/docker-compose.yml --with-registry-auth gestion-integral-stack | ||||
|              | ||||
|             # 4. Limpieza | ||||
|             echo "Realizando limpieza..." | ||||
|   | ||||
| @@ -112,9 +112,18 @@ builder.Services.AddHealthChecks() | ||||
| // --- Configuración de Autenticación JWT --- | ||||
| var jwtSettings = builder.Configuration.GetSection("Jwt"); | ||||
|  | ||||
| // Lee la RUTA al archivo del secreto desde la variable de entorno | ||||
| var jwtKeyFilePath = builder.Configuration["JWT_KEY_FILE"];  | ||||
|  | ||||
| // Si la ruta existe (estamos en Docker Swarm), lee el contenido del archivo. | ||||
| // Si no, vuelve a buscar la variable de entorno (para desarrollo local). | ||||
| var jwtKey = !string.IsNullOrEmpty(jwtKeyFilePath) && File.Exists(jwtKeyFilePath) | ||||
|     ? File.ReadAllText(jwtKeyFilePath).Trim() | ||||
|     : builder.Configuration["JWT_KEY"] ?? throw new ArgumentNullException("JWT Key not configured"); | ||||
|  | ||||
| // Le decimos que busque la clave JWT en la raíz de la configuración (donde están las variables de entorno). | ||||
| // Si no la encuentra, como respaldo, busca en la sección "Jwt" del appsettings. | ||||
| var jwtKey = builder.Configuration["JWT_KEY"] ?? /*jwtSettings["Key"] ??*/ throw new ArgumentNullException("JWT_KEY or Jwt:Key not configured"); | ||||
| //var jwtKey = builder.Configuration["JWT_KEY"] ?? /*jwtSettings["Key"] ??*/ throw new ArgumentNullException("JWT_KEY or Jwt:Key not configured"); | ||||
|  | ||||
| var keyBytes = Encoding.ASCII.GetBytes(jwtKey); | ||||
|  | ||||
|   | ||||
| @@ -6,7 +6,6 @@ | ||||
|     } | ||||
|   }, | ||||
|   "Jwt": { | ||||
|     "Key": "", | ||||
|     "Issuer": "GestionIntegralApi", | ||||
|     "Audience": "GestionIntegralClient", | ||||
|     "DurationInHours": 8 | ||||
|   | ||||
		Reference in New Issue
	
	Block a user