Project

General

Profile

« Previous | Next » 

Revision 3019cad0

Added by Jim Pingle over 2 years ago

Add plugin hook for nginx conf. Implements #13054

  • Plugin hook is called once for entries to be placed below locations in
    the main GUI server, and a second time for entries placed after all
    server stanzas.
  • See Redmine issue for usage examples

View differences:

src/etc/inc/system.inc
1474 1474

  
1475 1475
	}
1476 1476

  
1477
	$plugin_locations = "";
1478
	if ($captive_portal == false) {
1479
		$pluginparams = [ 'section' => 'location' ];
1480
		foreach (pkg_call_plugins('plugin_nginx', $pluginparams) as $pkgname => $location) {
1481
			if (empty($location)) {
1482
				continue;
1483
			}
1484
			$plugin_locations .= "# Plugin Locations ({$pkgname})\n";
1485
			$plugin_locations .= "{$location}\n";
1486
		}
1487
	}
1488

  
1477 1489
	$nginx_config .= <<<EOD
1478 1490
		root "{$document_root}";
1479 1491
		location / {
......
1506 1518
			fastcgi_read_timeout 360;
1507 1519
			include        /usr/local/etc/nginx/fastcgi_params;
1508 1520
		}
1521
		{$plugin_locations}
1509 1522
	}
1510 1523

  
1511 1524
EOD;
......
1555 1568
EOD;
1556 1569
	}
1557 1570

  
1571
	if ($captive_portal == false) {
1572
		$pluginparams = [ 'section' => 'server' ];
1573
		foreach (pkg_call_plugins('plugin_nginx', $pluginparams) as $pkgname => $server) {
1574
			if (empty($server)) {
1575
				continue;
1576
			}
1577
			$nginx_config .= "	# Plugin Servers ({$pkgname})\n";
1578
			$nginx_config .= "{$server}\n";
1579
		}
1580
	}
1581

  
1558 1582
	$nginx_config .= "}\n";
1559 1583

  
1560 1584
	$fd = fopen("{$filename}", "w");

Also available in: Unified diff