diff --git a/root/usr/share/smanager/lib/SrvMngr/Controller/Wireguard.pm b/root/usr/share/smanager/lib/SrvMngr/Controller/Wireguard.pm index 771b24e..a10cd14 100644 --- a/root/usr/share/smanager/lib/SrvMngr/Controller/Wireguard.pm +++ b/root/usr/share/smanager/lib/SrvMngr/Controller/Wireguard.pm @@ -23,11 +23,10 @@ use SrvMngr qw( theme_list init_session is_normal_password ); use esmith::ConfigDB; use Net::IP; -our $adb = esmith::AccountsDB->open() || die "Couldn't open accounts DB\ndb"; -our $cdb = esmith::ConfigDB->open() || die "Couldn't open config DB\n"; -our $wdb = esmith::ConfigDB->open('wireguard') || esmith::ConfigDB->create('wireguard'); -our $ndb = esmith::NetworksDB->open_ro || die "Error opening networks DB\n"; - +my $adb; +my $cdb; +my $wdb; +my $ndb; sub main { @@ -35,6 +34,8 @@ sub main { $c->app->log->info($c->log_req); my %wrg_datas = (); + $wdb = esmith::ConfigDB->open('wireguard') || esmith::ConfigDB->create('wireguard'); + my $title = $c->l('wrg_FORM_TITLE'); $wrg_datas{'trt'} = 'LST'; @@ -74,6 +75,11 @@ sub do_display { my $title = $c->l('wrg_FORM_TITLE'); my $modul = ''; + $adb = esmith::AccountsDB->open() || die "Couldn't open accounts DB\ndb"; + $cdb = esmith::ConfigDB->open() || die "Couldn't open config DB\n"; + $wdb = esmith::ConfigDB->open('wireguard') || esmith::ConfigDB->create('wireguard'); + #$ndb = esmith::NetworksDB->open_ro || die "Error opening networks DB\n"; + $wrg_datas{'trt'} = $trt; if ( $trt eq 'QRC' ) { @@ -140,6 +146,11 @@ sub do_action { my $result = ''; my $res = ''; + $adb = esmith::AccountsDB->open() || die "Couldn't open accounts DB\ndb"; + $cdb = esmith::ConfigDB->open() || die "Couldn't open config DB\n"; + $wdb = esmith::ConfigDB->open('wireguard') || esmith::ConfigDB->create('wireguard'); + $ndb = esmith::NetworksDB->open_ro || die "Error opening networks DB\n"; + if ( $trt eq 'QRC' ) { # NEVER } @@ -572,4 +583,4 @@ sub test_for_private_ip { 1 -__END__ +__END__ \ No newline at end of file diff --git a/smeserver-wireguard.spec b/smeserver-wireguard.spec index 33a076b..169ccbd 100644 --- a/smeserver-wireguard.spec +++ b/smeserver-wireguard.spec @@ -1,4 +1,4 @@ -%define release 23 +%define release 24 %define version 1.0 %define debug_package %{nil} @@ -61,6 +61,9 @@ fi %changelog +* Wed Sep 24 2025 Brian Read 1.0-24.sme +- Sort out access to DB vis a vis caching [SME: 13168] + * Mon Sep 22 2025 Brian Read 1.0-23.sme - add debuginfo define to suppress it [SME: 13168] - Fix config call in layout [SME: 13168]