diff --git a/pfSense-pkg-RESTAPI/files/usr/local/pkg/RESTAPI/Models/HAProxyFrontend.inc b/pfSense-pkg-RESTAPI/files/usr/local/pkg/RESTAPI/Models/HAProxyFrontend.inc index 90357d6b..eb36a980 100644 --- a/pfSense-pkg-RESTAPI/files/usr/local/pkg/RESTAPI/Models/HAProxyFrontend.inc +++ b/pfSense-pkg-RESTAPI/files/usr/local/pkg/RESTAPI/Models/HAProxyFrontend.inc @@ -3,6 +3,7 @@ namespace RESTAPI\Models; use RESTAPI\Core\Model; +use RESTAPI\Dispatchers\HAProxyApplyDispatcher; use RESTAPI\Fields\Base64Field; use RESTAPI\Fields\BooleanField; use RESTAPI\Fields\ForeignModelField; @@ -180,4 +181,18 @@ class HAProxyFrontend extends Model { parent::__construct($id, $parent_id, $data, ...$options); } + + /** + * Ensures haproxy is marked as dirty before applying. + */ + public function pre_apply(): void { + touch('/var/run/haproxy.conf.dirty'); + } + + /** + * Applies changes to the HAProxy configuration. + */ + public function apply(): void { + (new HAProxyApplyDispatcher(async: $this->async))->spawn_process(); + } }