From 0924817a7694544b1bfae3cd682703bc021bb9fb Mon Sep 17 00:00:00 2001 From: Dmitry Maksyoma Date: Wed, 14 May 2025 21:30:58 +1200 Subject: [PATCH] VNC-155 ConfigKey can have both type and validator Type can check whether value is boolean or int, and validator can check whether another configuration key is defined, for example. --- unix/KasmVNC/ConfigKey.pm | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/unix/KasmVNC/ConfigKey.pm b/unix/KasmVNC/ConfigKey.pm index f60fd63..b8ff425 100644 --- a/unix/KasmVNC/ConfigKey.pm +++ b/unix/KasmVNC/ConfigKey.pm @@ -32,13 +32,6 @@ sub validate { return if $self->isValueBlank(); - if ($self->{validator}) { - $self->resolveValidatorFromFunction() if (ref $self->{validator} eq "CODE"); - - $self->{validator}->validate($self); - return; - } - switch($self->{type}) { case INT { $self->validateInt(); @@ -47,6 +40,13 @@ sub validate { $self->validateBoolean(); } } + + if ($self->{validator}) { + $self->resolveValidatorFromFunction() if (ref $self->{validator} eq "CODE"); + + $self->{validator}->validate($self); + return; + } } sub resolveValidatorFromFunction {