Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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();
}
}