refs #1053 Adds new parameter to nginx template to public dinamic dir. Use dinamic route to obtain disk usage function in controller
testing/og-dhcp-API/pipeline/head There was a failure building this commit Details

nginx_conf
Luis Gerardo Romero Garcia 2024-10-28 07:23:15 +01:00
parent 89c5c8dca3
commit 18811105a6
3 changed files with 6 additions and 4 deletions

View File

@ -3,7 +3,7 @@ server {
server_name __SERVERIP__ localhost; # IP del servidor
# Raíz del documento para el proyecto Symfony
root /opt/ogdhcp/public;
root __PUBLICDIR__;
# Bloque para manejar las solicitudes a /ogdhcp
location /ogdhcp {

View File

@ -373,7 +373,8 @@ add_write_permission_apparmor() {
# Función para configurar Nginx
setup_nginx() {
local path_opengnsys_base="$1"
local public_dir="$path_opengnsys_base/public"
#ip_address_server=$(get_ip_address "$DEFAULTDEV")
if [[ ! -f "$CONFIG_FILE" ]]; then
echo "Error: El archivo de configuración no se encontró."
@ -398,10 +399,11 @@ setup_nginx() {
echo "Error: La plantilla de Nginx no se encontró."
exit 1
fi
nginx_content=$(<"$NGINX_TEMPLATE")
nginx_content="${nginx_content//__SERVERIP__/$ip_address_server}"
nginx_content="${nginx_content//__PHPVERSION__/$php_version}"
nginx_content="${nginx_content//__PUBLICDIR__/$public_dir}"
# Crear el archivo de configuración de Nginx
echo "$nginx_content" > "$NGINX_OUTPUT"

View File

@ -98,7 +98,7 @@ class DhcpController
private function getDiskUsage(): array
{
// Simular la salida del comando df para obtener el uso del disco
$output = shell_exec("df -h /opt/ogdhcp | tail -1 | awk '{print $2, $3, $4, $5}'");
$output = shell_exec("df -h " . realpath($this->backup_dir) . " | tail -1 | awk '{print $2, $3, $4, $5}'");
if (!$output) {
$this->logger->error("Failed to execute disk usage command");
return null;