vncserver: add debug output on config load

This commit is contained in:
Dmitry Maksyoma 2023-02-23 05:40:12 +13:00
parent a1b138e5e1
commit 797c57121a
2 changed files with 7 additions and 2 deletions

View File

@ -8,6 +8,8 @@ use Data::Dumper;
use Hash::Merge::Simple; use Hash::Merge::Simple;
use KasmVNC::Utils; use KasmVNC::Utils;
our $logger;
sub merge { sub merge {
my @configsToMerge = map { $_->{data} } @_; my @configsToMerge = map { $_->{data} } @_;
my $mergedConfig = Hash::Merge::Simple::merge(@configsToMerge) // {}; my $mergedConfig = Hash::Merge::Simple::merge(@configsToMerge) // {};
@ -31,6 +33,7 @@ sub load {
failIfConfigNotReadable($self->{filename}); failIfConfigNotReadable($self->{filename});
$logger->debug("Loading config " . $self->{filename});
$self->{data} = YAML::Tiny->read($self->{filename})->[0]; $self->{data} = YAML::Tiny->read($self->{filename})->[0];
} }

View File

@ -1171,6 +1171,7 @@ sub DefineFilePathsAndStuff {
$KasmVNC::Users::vncPasswdBin = $exedir . "kasmvncpasswd"; $KasmVNC::Users::vncPasswdBin = $exedir . "kasmvncpasswd";
$KasmVNC::Users::logger = $logger; $KasmVNC::Users::logger = $logger;
$KasmVNC::Config::logger = $logger;
$vncSystemConfigDir = "/etc/kasmvnc"; $vncSystemConfigDir = "/etc/kasmvnc";
if ($ENV{KASMVNC_DEVELOPMENT}) { if ($ENV{KASMVNC_DEVELOPMENT}) {
@ -1979,7 +1980,7 @@ sub DefineConfigToCLIConversion {
$self = shift; $self = shift;
my @values = @{ listify($self->configValues()) }; my @values = @{ listify($self->configValues()) };
my $valuesStr = ""; my $valuesStr = "";
foreach $value (@values) { foreach $value (@values) {
$valuesStr = $valuesStr . "-http-header '$value' " $valuesStr = $valuesStr . "-http-header '$value' "
@ -2754,5 +2755,6 @@ sub SetAppSettingsFromConfigAndCli {
} }
sub InitLogger { sub InitLogger {
$logger = KasmVNC::Logger->new(); my $debugEnabled = any { $_ eq "-debug" } @ARGV;
$logger = KasmVNC::Logger->new({ level => $debugEnabled ? "debug" : "warn" });
} }