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
|
# 3. Despliegue con Docker Compose
|
||||||
cd /opt/gestion-integral
|
cd /opt/gestion-integral
|
||||||
export DB_SA_PASSWORD='${{ secrets.DB_SA_PASSWORD_SECRET }}'
|
export DB_SA_PASSWORD='${{ secrets.DB_SA_PASSWORD_SECRET }}'
|
||||||
export JWT_KEY='${{ secrets.JWT_KEY }}'
|
|
||||||
|
|
||||||
# --- PASO DE DEPURACIÓN ---
|
# Pasa el secreto de Gitea a un Docker Secret
|
||||||
echo "Verificando variables de entorno..."
|
# El comando "tr -d '\n'" elimina cualquier salto de línea final
|
||||||
echo "Longitud de DB_SA_PASSWORD: ${#DB_SA_PASSWORD}"
|
printf "%s" "${{ secrets.JWT_KEY }}" | tr -d '\n' | docker secret create jwt_secret_key - || docker secret inspect jwt_secret_key > /dev/null
|
||||||
echo "Longitud de JWT_KEY: ${#JWT_KEY}"
|
|
||||||
# -------------------------
|
|
||||||
|
|
||||||
echo "Recreando servicios..."
|
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
|
# 4. Limpieza
|
||||||
echo "Realizando limpieza..."
|
echo "Realizando limpieza..."
|
||||||
|
|||||||
@@ -112,9 +112,18 @@ builder.Services.AddHealthChecks()
|
|||||||
// --- Configuración de Autenticación JWT ---
|
// --- Configuración de Autenticación JWT ---
|
||||||
var jwtSettings = builder.Configuration.GetSection("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).
|
// 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.
|
// 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);
|
var keyBytes = Encoding.ASCII.GetBytes(jwtKey);
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,6 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"Jwt": {
|
"Jwt": {
|
||||||
"Key": "",
|
|
||||||
"Issuer": "GestionIntegralApi",
|
"Issuer": "GestionIntegralApi",
|
||||||
"Audience": "GestionIntegralClient",
|
"Audience": "GestionIntegralClient",
|
||||||
"DurationInHours": 8
|
"DurationInHours": 8
|
||||||
|
|||||||
Reference in New Issue
Block a user