add assigned_central_version column to controllers_ctl

Allow controllers to advertise which central version (cv1, cv2, or all)
they are assigned to handle via a new configurable field. The value is
persisted to the database on each heartbeat and validated at startup
against the DB CHECK constraint.
This commit is contained in:
Grant Limberg 2026-03-17 16:30:25 -07:00
parent a840b94e0d
commit 2c57f85e25
6 changed files with 22 additions and 4 deletions

View file

@ -1813,6 +1813,17 @@ class OneServiceImpl : public OneService {
if (cc.is_object()) {
_controllerConfig.listenMode = OSUtils::jsonString(cc["listenMode"], "pgsql");
_controllerConfig.statusMode = OSUtils::jsonString(cc["statusMode"], "pgsql");
// Valid values must match CHECK constraint in migration 0007_assigned_version
{
const std::string av = OSUtils::jsonString(cc["assignedCentralVersion"], "all");
if (av != "cv1" && av != "cv2" && av != "all") {
fprintf(
stderr,
"ERROR: assignedCentralVersion must be one of 'cv1', 'cv2', or 'all'" ZT_EOL_S);
exit(1);
}
_controllerConfig.assignedCentralVersion = av;
}
// redis settings
if (cc["redis"].is_object() && _rc == NULL) {