Skip to content

Commit e56d961

Browse files
Merge pull request #680 from jaredhendrickson13/next_patch
2 parents 1b80ff6 + 40f6223 commit e56d961

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

pfSense-pkg-RESTAPI/files/usr/local/pkg/RESTAPI/Models/HAProxyFrontend.inc

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
namespace RESTAPI\Models;
44

55
use RESTAPI\Core\Model;
6+
use RESTAPI\Dispatchers\HAProxyApplyDispatcher;
67
use RESTAPI\Fields\Base64Field;
78
use RESTAPI\Fields\BooleanField;
89
use RESTAPI\Fields\ForeignModelField;
@@ -180,4 +181,18 @@ class HAProxyFrontend extends Model {
180181

181182
parent::__construct($id, $parent_id, $data, ...$options);
182183
}
184+
185+
/**
186+
* Ensures haproxy is marked as dirty before applying.
187+
*/
188+
public function pre_apply(): void {
189+
touch('/var/run/haproxy.conf.dirty');
190+
}
191+
192+
/**
193+
* Applies changes to the HAProxy configuration.
194+
*/
195+
public function apply(): void {
196+
(new HAProxyApplyDispatcher(async: $this->async))->spawn_process();
197+
}
183198
}

0 commit comments

Comments
 (0)