Compare commits

...

10 Commits

Author SHA1 Message Date
Nicolas Arenas cdc24f0c33 Fix typo in pipeline
testing/ogcore-api/pipeline/head This commit looks good Details
ogcore-debian-package/pipeline/head There was a failure building this commit Details
2025-03-13 18:51:33 +01:00
Nicolas Arenas 74456f85a1 add Jenkinsfile to build package in Jenkins
ogcore-debian-package/pipeline/head There was a failure building this commit Details
testing/ogcore-api/pipeline/head There was a failure building this commit Details
2025-03-13 18:49:13 +01:00
Manuel Aranda Rosales 33b8cba802 Fixed test. Removed Mercure from test env 2025-03-13 17:33:34 +01:00
Manuel Aranda Rosales c3ee618c6e Fixed test. Removed Mercure from test env 2025-03-13 17:33:34 +01:00
Nicolas Arenas 145e50a453 Update changelog for 0.9.2 release 2025-03-13 17:33:34 +01:00
Manuel Aranda Rosales 02646f0c4b Updated changelog 2025-03-13 17:33:34 +01:00
Nicolas Arenas 852d3ccd14 Add mercure service to docker-compose for deploy 2025-03-13 17:33:34 +01:00
Manuel Aranda Rosales 24352cc2c8 Updated and fixed cancel P2p transmission 2025-03-13 17:33:34 +01:00
Nicolas Arenas 9713c83f57 remove old DEBIAN directory
testing/ogcore-api/pipeline/head There was a failure building this commit Details
2025-03-10 15:19:04 +01:00
Nicolas Arenas f778c337fb Added debian packaging
testing/ogcore-api/pipeline/head There was a failure building this commit Details
testing/ogcore-api/pipeline/pr-main This commit looks good Details
2025-03-10 15:16:24 +01:00
29 changed files with 437 additions and 95 deletions

8
.gitignore vendored
View File

@ -25,3 +25,11 @@
/phpunit.xml
.phpunit.result.cache
###< phpunit/phpunit ###
### Debian packaging
debian/ogcore
debian/*.substvars
debian/*.log
debian/.debhelper/

View File

@ -1,4 +1,13 @@
# Changelog
## [0.9.2] - 2025-03-12
### Fixed
- Added mercure service in docker compose file for deployments.
## [0.9.1] - 2025-03-12
### 🐛 Fixed
- Corrección en la cancelacion de transmisiones p2p.
## [0.9.0] - 2025-03-04
### 🔹 Added
- Nueva funcionalidad para tener notificaciones en tiempo real. Instalación de bundle "Mercure".
@ -50,4 +59,4 @@
- **Added**: Secciones con nuevas características.
- **Fixed**: Corrección de errores y bugs.
- **Changed**: Modificaciones o mejoras en funcionalidades existentes.
- **Removed**: Funcionalidades o dependencias eliminadas.
- **Removed**: Funcionalidades o dependencias eliminadas.

View File

@ -1,5 +0,0 @@
ogcore (1.0) unstable; urgency=low
* Initial release.
-- Your Name <your.email@example.com> Thu, 01 Jan 1970 00:00:00 +0000

View File

@ -1,12 +0,0 @@
Package: ogcore
Version: %%VERSION%%
Section: base
Priority: optional
Architecture: all
Depends: mariadb-server, systemd, nginx, libzip-dev, zip, unzip, php8.3-opcache,
php8.3-bcmath, php8.3-cli, php8.3-curl, php8.3-fpm, php8.3-gd,
php8.3-ldap, php8.3-mbstring, php8.3-mysql, php8.3-common,
php8.3-xml, php8.3-zip
Maintainer: Nicolas Arenas <nicolas.arenas@qindel.com>
Description: Description of the ogcore package
This is a longer description of the ogcore package.

View File

@ -1,21 +0,0 @@
Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: ogcore
Source: <source URL>
Files: *
Copyright: 2023 Your Name <your.email@example.com>
License: GPL-3+
This package is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
.
This package is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
.
You should have received a copy of the GNU General Public License
along with this package; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
MA 02110-1301 USA.

View File

@ -1,54 +0,0 @@
#!/bin/bash
set -e
# Asegurarse de que el usuario exista
USER="opengnsys"
# Provisionar base de datos si es necesario en caso de instalación.
# Detectar si es una instalación nueva o una actualización
if [ "$1" = "configure" ] && [ -z "$2" ]; then
cd /opt/opengnsys/ogcore/api
mariadb -e "GRANT ALL ON *.* to 'root'@'localhost' IDENTIFIED BY 'root' WITH GRANT OPTION;"
echo "Primera instalación"
# Provisionar base de datos si es necesario en caso de instalación.
echo "Creando par de claves para JWT"
php bin/console lexik:jwt:generate-keypair --overwrite
echo "Creando base de datos y cargando datos iniciales"
php bin/console doctrine:database:create --if-not-exists
php bin/console doctrine:migrations:migrate --no-interaction
# Cargar datos iniciales
echo "Cargando datos iniciales"
php bin/console opengnsys:load-default-user
echo "Cargando usuarios y grupos por defecto"
php bin/console app:load-default-user-groups
echo "Cargando comandos por defecto"
php bin/console app:load-default-commands
echo "Cargando menú por defecto"
php bin/console opengnsys:load-default-menu
elif [ "$1" = "configure" ] && [ -n "$2" ]; then
cd /opt/opengnsys/ogcore/api
echo "Actualización desde la versión $2"
# Ejecutar comandos específicos para la actualización
php bin/console doctrine:migrations:migrate --no-interaction
# Otros comandos específicos para la actualización
fi
# Cambiar la propiedad de los archivos al usuario especificado
chown opengnsys:www-data /opt/opengnsys/
chown -R opengnsys:www-data /opt/opengnsys/ogcore
# Install http server stuff
ln -s /opt/opengnsys/ogcore/etc/nginx/sites-available/ogcore.conf /etc/nginx/sites-enabled/ogcore.conf
ln -s /opt/opengnsys/ogcore/etc/php/8.3/fpm/pool.d/ogcore-fpm.conf /etc/php/8.3/fpm/pool.d/ogcore-fpm.conf
# Reiniciar servicios si es necesario
# systemctl restart nombre_del_servicio
systemctl daemon-reload
systemctl restart nginx
systemctl restart php8.3-fpm
exit 0

View File

@ -0,0 +1,28 @@
pipeline {
agent {
label 'jenkins-slave'
}
environment {
DEBIAN_FRONTEND = 'noninteractive'
BUILD_DIR = "${WORKSPACE}/source"
}
stages {
stage('Checkout') {
steps {
script {
sh "mkdir -p ${BUILD_DIR}" // Creamos el directorio
dir("${BUILD_DIR}") {
checkout scm // Hacemos el checkout en el subdirectorio
}
}
}
}
stage('Build') {
steps {
dir ("${BUILD_DIR}") {
sh 'dpkg-buildpackage -us -uc'
}
}
}
}
}

4
debian/CHANGELOG.md vendored 100644
View File

@ -0,0 +1,4 @@
# Changelog
## [Unreleased]

14
debian/changelog vendored 100644
View File

@ -0,0 +1,14 @@
ogcore (1.0.5+develop20250310-1) unstable; urgency=medium
* Modified changelog
* Some improvements. Fixed multi select actions
* refs #1644. Cancel deployImage action
* Updated test phunit.xml
* Updated test
* Merge branch 'main' into develop
* Fixed phpxml
* Fixed phpxml
* Changed test
* Changed repoClient funcionality. New filters added
-- Tu Nombre <tuemail@example.com> Mon, 10 Mar 2025 10:59:14 +0000

1
debian/compat vendored 100644
View File

@ -0,0 +1 @@
12

16
debian/control vendored 100644
View File

@ -0,0 +1,16 @@
Source: ogcore
Section: web
Priority: optional
Maintainer: Nicolas Arenas <nicolas.arenas@qindel.com>
Build-Depends: debhelper (>= 12), composer, php-cli, php-mysql, nginx, php-fpm, libzip-dev, zip, unzip
Standards-Version: 4.5.0
Package: ogcore
Architecture: all
Depends: ${misc:Depends}, mariadb-server, systemd, nginx, libzip-dev, zip, unzip,
php8.3-opcache, php8.3-bcmath, php8.3-cli, php8.3-curl, php8.3-fpm,
php8.3-gd, php8.3-ldap, php8.3-mbstring, php8.3-mysql, php8.3-common,
php8.3-xml, php8.3-zip, mercure
Description: OpenGnsys Core
This is a longer description of the ogcore package.
OpenGnsys Core is a platform for system management.

21
debian/convert.sh vendored 100644
View File

@ -0,0 +1,21 @@
#!/bin/bash
set -x
INPUT_FILE="changelog"
OUTPUT_FILE="CHANGELOG.md"
echo "# Changelog" > "$OUTPUT_FILE"
echo -e "\n## [Unreleased]\n" >> "$OUTPUT_FILE"
# Procesar el changelog de Debian
awk '
/^ogcore/ {
version = $2
gsub(/[()]/, "", version) # Eliminar paréntesis de la versión
printf "\n## [%s] - %s\n\n", version, $NF
}
/^\s*\*/ {
gsub(/^\s*\*\s*/, "- ", $0) # Convertir a lista de viñetas
print $0 >> "'"$OUTPUT_FILE"'"
}
' "$INPUT_FILE"

43
debian/copyright vendored 100644
View File

@ -0,0 +1,43 @@
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Source: <url://example.com>
Upstream-Name: ogcore
Upstream-Contact: <preferred name and address to reach the upstream project>
Files:
*
Copyright:
<years> <put author's name and email here>
<years> <likewise for another author>
License: GPL-3.0+
Files:
debian/*
Copyright:
2025 root <root@build>
License: GPL-3.0+
License: GPL-3.0+
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
.
This package is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
Comment:
On Debian systems, the complete text of the GNU General
Public License version 3 can be found in "/usr/share/common-licenses/GPL-3".
# Please also look if there are files or directories which have a
# different copyright/license attached and list them here.
# Please avoid picking licenses with terms that are more restrictive than the
# packaged work, as it may make Debian's contributions unacceptable upstream.
#
# If you need, there are some extra license texts available in two places:
# /usr/share/debhelper/dh_make/licenses/
# /usr/share/common-licenses/

1
debian/debhelper-build-stamp vendored 100644
View File

@ -0,0 +1 @@
ogcore

2
debian/files vendored 100644
View File

@ -0,0 +1,2 @@
ogcore_1.0.5+develop20250310-1_all.deb web optional
ogcore_1.0.5+develop20250310-1_amd64.buildinfo web optional

18
debian/ogcore.install vendored 100644
View File

@ -0,0 +1,18 @@
bin/* /opt/opengnsys/ogcore/api/bin/
config/* /opt/opengnsys/ogcore/api/config/
migrations/* /opt/opengnsys/ogcore/api/migrations/
public/* /opt/opengnsys/ogcore/api/public/
src/* /opt/opengnsys/ogcore/api/src/
swagger-assets/* /opt/opengnsys/ogcore/api/swagger-assets/
templates/* /opt/opengnsys/ogcore/api/templates/
translations/* /opt/opengnsys/ogcore/api/translations/
var/* /opt/opengnsys/ogcore/api/var/
vendor/* /opt/opengnsys/ogcore/api/vendor/
composer.json /opt/opengnsys/ogcore/api/
composer.lock /opt/opengnsys/ogcore/api/
symfony.lock /opt/opengnsys/ogcore/api/
.env.local.php /opt/opengnsys/ogcore/api/
env.json /opt/opengnsys/ogcore/api/
etc /opt/opengnsys/ogcore/
docker/certs/* /opt/opengnsys/ogcore/etc/nginx/certs/

112
debian/ogcore.postinst vendored 100644
View File

@ -0,0 +1,112 @@
#!/bin/bash
set -e
set -x
. /usr/share/debconf/confmodule
USER="opengnsys"
# Detectar si es una instalación nueva o una actualización
if [ "$1" = "configure" ] && [ -z "$2" ]; then
echo ">>> Instalación nueva detectada."
# Solicitar credenciales solo en instalación nueva
db_input high opengnsys/ogcore_adminUser || true
db_go
db_get opengnsys/ogcore_adminUser
ADMIN_USER="$RET"
db_input high opengnsys/ogcore_adminPass || true
db_go
db_get opengnsys/ogcore_adminPass
ADMIN_PASS="$RET"
cd /opt/opengnsys/ogcore/api
# Configuración inicial
echo ">>> Configurando base de datos y permisos"
mariadb -e "GRANT ALL ON *.* to 'root'@'localhost' IDENTIFIED BY 'root' WITH GRANT OPTION;"
echo ">>> Creando par de claves para JWT"
php bin/console lexik:jwt:generate-keypair --overwrite
echo ">>> Creando base de datos"
php bin/console doctrine:database:create --if-not-exists
php bin/console doctrine:migrations:migrate --no-interaction
echo ">>> Cargando datos iniciales"
php bin/console opengnsys:load-default-user
php bin/console app:load-default-user-groups
php bin/console app:load-default-commands
php bin/console opengnsys:load-default-menu
echo ">>> Configurando servidor web y servicios"
ln -s /opt/opengnsys/ogcore/etc/nginx/sites-available/ogcore.conf /etc/nginx/sites-enabled/ogcore.conf
ln -s /opt/opengnsys/ogcore/etc/php/8.3/fpm/pool.d/ogcore-fpm.conf /etc/php/8.3/fpm/pool.d/ogcore-fpm.conf
ln -s /opt/opengnsys/ogcore/etc/systemd/system/og-mercure.service /etc/systemd/system/og-mercure.service
echo ">>> Configurando permisos de archivos"
chown opengnsys:www-data /opt/opengnsys/
chown -R opengnsys:www-data /opt/opengnsys/ogcore
systemctl daemon-reload
systemctl enable og-mercure
systemctl restart og-mercure
systemctl restart nginx
systemctl restart php8.3-fpm
# Solo gestionar credenciales en instalación nueva
if [ "$ADMIN_USER" == "ogadmin" ]; then
BEARER=$(curl -sk -X 'POST' 'https://localhost:8443/auth/login' \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
-d '{ "username": "ogadmin", "password": "12345678" }' | jq -r .token)
echo ">>> Cambiando contraseña de ogadmin"
OGADMIN_UUID=$(curl -skL "https://localhost:8443/users/?username=ogadmin" \
-H 'accept: application/json' \
-H "Authorization: Bearer $BEARER" | jq -r '.[0].uuid')
curl -skL -X PUT "https://localhost:8443/users/$OGADMIN_UUID/reset-password" \
-H 'accept: application/ld+json' \
-H 'Content-Type: application/ld+json' \
-H "Authorization: Bearer $BEARER" \
-d "{ \"currentPassword\": \"12345678\", \"newPassword\": \"$ADMIN_PASS\", \"repeatNewPassword\": \"$ADMIN_PASS\" }"
echo ">>> Contraseña de ogadmin cambiada."
else
echo ">>> Creando nuevo usuario administrador: $ADMIN_USER"
curl -skL --location 'https://localhost:8443/users' \
--header 'Content-Type: application/json' \
--header "Authorization: Bearer $BEARER" \
--data "{ \"username\": \"$ADMIN_USER\", \"password\": \"$ADMIN_PASS\", \"roles\": [\"ROLE_SUPER_ADMIN\"] }"
echo ">>> Usuario administrador $ADMIN_USER creado."
fi
elif [ "$1" = "configure" ] && [ -n "$2" ]; then
echo ">>> Actualización detectada desde la versión $2"
cd /opt/opengnsys/ogcore/api
echo ">>> Aplicando migraciones de base de datos"
php bin/console doctrine:migrations:migrate --no-interaction
echo ">>> Configurando servidor web y servicios"
ln -s /opt/opengnsys/ogcore/etc/nginx/sites-available/ogcore.conf /etc/nginx/sites-enabled/ogcore.conf
ln -s /opt/opengnsys/ogcore/etc/php/8.3/fpm/pool.d/ogcore-fpm.conf /etc/php/8.3/fpm/pool.d/ogcore-fpm.conf
ln -s /opt/opengnsys/ogcore/etc/systemd/system/og-mercure.service /etc/systemd/system/og-mercure.service
echo ">>> Configurando permisos de archivos"
chown opengnsys:www-data /opt/opengnsys/
chown -R opengnsys:www-data /opt/opengnsys/ogcore
systemctl daemon-reload
systemctl enable og-mercure
systemctl restart og-mercure
systemctl restart nginx
systemctl restart php8.3-fpm
fi
# Recargar systemd y reiniciar servicios en ambos casos
exit 0

6
debian/ogcore.postrm.debhelper vendored 100644
View File

@ -0,0 +1,6 @@
# Automatically added by dh_installdebconf/13.14.1ubuntu5
if [ "$1" = purge ] && [ -e /usr/share/debconf/confmodule ]; then
. /usr/share/debconf/confmodule
db_purge
fi
# End automatically added section

19
debian/ogcore.prerm vendored 100755
View File

@ -0,0 +1,19 @@
#!/bin/bash
set -e
set -x
if [ "$1" = "remove" ] || [ "$1" = "upgrade" ]; then
# Eliminar enlaces simbólicos creados en postinst
rm -f /etc/nginx/sites-enabled/ogcore.conf
rm -f /etc/php/8.3/fpm/pool.d/ogcore-fpm.conf
# Deshabilitar el servicio antes de eliminarlo
systemctl disable og-mercure || true
systemctl stop og-mercure || true
systemctl restart nginx || true
systemctl restart php8.3-fpm || true
rm -f /etc/systemd/system/og-mercure.service
systemctl daemon-reload
fi
exit 0

10
debian/ogcore.templates vendored 100644
View File

@ -0,0 +1,10 @@
Template: opengnsys/ogcore_adminUser
Type: string
Default: ogadmin
Description: Introduzca el nombre de usuario para la configuración
Template: opengnsys/ogcore_adminPass
Type: password
Default: 12345678
Description: Introduzca la contraseña

12
debian/rules vendored 100755
View File

@ -0,0 +1,12 @@
#!/usr/bin/make -f
%:
dh $@
# Ejecutar composer install durante la fase de construcción
override_dh_auto_build:
export COMPOSER_ALLOW_SUPERUSER=1
export APP_ENV=prod
dh_auto_build
composer dump-env prod
composer install --no-dev --no-interaction --no-progress --optimize-autoloader

1
debian/source/format vendored 100644
View File

@ -0,0 +1 @@
3.0 (native)

View File

@ -39,9 +39,32 @@ services:
- ogcore-network
image: opengnsys/ogcore-php:static
mercure:
image: dunglas/mercure
restart: unless-stopped
container_name: ogcore-mercure
environment:
# Uncomment the following line to disable HTTPS,
SERVER_NAME: ':3000'
MERCURE_PUBLISHER_JWT_KEY: '!ChangeThisMercureHubJWTSecretKey!'
MERCURE_SUBSCRIBER_JWT_KEY: '!ChangeThisMercureHubJWTSecretKey!'
MERCURE_EXTRA_DIRECTIVES: |
cors_origins *
# Comment the following line to disable the development mode
command: /usr/bin/caddy run --config /etc/caddy/dev.Caddyfile
ports:
- "3000:3000"
volumes:
- mercure_data:/data
- mercure_config:/config
networks:
- ogcore-network
volumes:
database_data:
ogpublic:
mercure_data:
mercure_config:
networks:

View File

@ -0,0 +1,4 @@
SERVER_NAME=":3000"
MERCURE_PUBLISHER_JWT_KEY="!ChangeThisMercureHubJWTSecretKey!"
MERCURE_SUBSCRIBER_JWT_KEY="!ChangeThisMercureHubJWTSecretKey!"
MERCURE_EXTRA_DIRECTIVES="cors_origins *"

View File

@ -0,0 +1,44 @@
# Learn how to configure the Mercure.rocks Hub on https://mercure.rocks/docs/hub/config
{
{$GLOBAL_OPTIONS}
}
{$CADDY_EXTRA_CONFIG}
{$SERVER_NAME:localhost} {
log {
format filter {
fields {
request>uri query {
replace authorization REDACTED
}
}
}
}
encode zstd gzip
mercure {
# Publisher JWT key
publisher_jwt {env.MERCURE_PUBLISHER_JWT_KEY} {env.MERCURE_PUBLISHER_JWT_ALG}
# Subscriber JWT key
subscriber_jwt {env.MERCURE_SUBSCRIBER_JWT_KEY} {env.MERCURE_SUBSCRIBER_JWT_ALG}
# Permissive configuration for the development environment
cors_origins *
publish_origins *
demo
anonymous
subscriptions
# Extra directives
{$MERCURE_EXTRA_DIRECTIVES}
}
{$CADDY_SERVER_EXTRA_DIRECTIVES}
redir / /.well-known/mercure/ui/
respond /healthz 200
respond /robots.txt `User-agent: *
Disallow: /`
respond "Not Found" 404
}

View File

@ -0,0 +1,27 @@
[Unit]
Description=Mercure Hub
After=network.target
Wants=network-online.target
[Service]
Type=simple
User=opengnsys
Group=opengnsys
WorkingDirectory=/opt/opengnsys/ogcore/
# Cargar variables de entorno desde archivo
EnvironmentFile=/opt/opengnsys/ogcore/etc/mercure/mercure-og.env
# Validar configuración antes de arrancar
ExecStartPre=/bin/sh -c '/usr/bin/mercure adapt -c /opt/opengnsys/ogcore/etc/mercure/mercure.orig.conf --envfile /opt/opengnsys/ogcore/etc/mercure/mercure-og.env > /opt/opengnsys/ogcore/etc/mercure/mercure.config'
ExecStartPre=/bin/sh -c '/usr/bin/mercure fmt --overwrite -c /opt/opengnsys/ogcore/etc/mercure/mercure.config'
# Iniciar y detener el servicio con la configuración generada
ExecStart=/usr/bin/mercure run -c /opt/opengnsys/ogcore/etc/mercure/mercure.config --envfile /opt/opengnsys/ogcore/etc/mercure/mercure-og.env
ExecStop=/usr/bin/mercure stop -c /opt/opengnsys/ogcore/etc/mercure/mercure.config
Restart=always
RestartSec=5s
[Install]
WantedBy=multi-user.target

View File

@ -8,6 +8,7 @@ use App\Entity\Image;
use App\Entity\ImageImageRepository;
use App\Entity\Trace;
use App\Model\CommandTypes;
use App\Model\DeployMethodTypes;
use App\Model\TraceStatus;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Response;
@ -52,7 +53,11 @@ class CancelTransmissionAction extends AbstractOgRepositoryController
throw new ValidatorException('Fullsum is required');
}
$content = $this->createRequest('DELETE', 'http://'.$image->getRepository()->getIp().':8006/ogrepository/v1/'.$method.'/images/'.$image->getImageFullsum());
if ($method === DeployMethodTypes::TORRENT) {
$content = $this->createRequest('DELETE', 'http://'.$image->getRepository()->getIp().':8006/ogrepository/v1/p2p');
} else {
$content = $this->createRequest('DELETE', 'http://'.$image->getRepository()->getIp().':8006/ogrepository/v1/'.$method.'/images/'.$image->getImageFullsum());
}
if (isset($content['error']) && $content['error'] === Response::HTTP_INTERNAL_SERVER_ERROR ) {
throw new ValidatorException('Error cancelling transmission');

View File

@ -10,6 +10,7 @@ use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpKernel\Event\ViewEvent;
use Symfony\Component\HttpKernel\KernelEvents;
use Psr\Log\LoggerInterface;
use Symfony\Component\HttpKernel\KernelInterface;
use Symfony\Component\Mercure\HubInterface;
use Symfony\Component\Mercure\Update;
@ -19,7 +20,8 @@ class MercureSubscriber implements EventSubscriberInterface
public function __construct(
LoggerInterface $logger,
private readonly HubInterface $hub
private readonly HubInterface $hub,
private readonly KernelInterface $kernel
)
{
$this->logger = $logger;
@ -34,6 +36,10 @@ class MercureSubscriber implements EventSubscriberInterface
public function onKernelView(ViewEvent $event): void
{
if ('test' === $this->kernel->getEnvironment()) {
return;
}
$request = $event->getRequest();
$method = $request->getMethod();