diff options
author | Jannis M. Hoffmann <jannis@fehcom.de> | 2023-09-07 16:01:45 +0200 |
---|---|---|
committer | Jannis M. Hoffmann <jannis@fehcom.de> | 2023-09-07 16:01:45 +0200 |
commit | 6643797d380092261fdca4140eafb7c4c7cd8ca5 (patch) | |
tree | d36a576d22ed4b25c1107112fef4924ef0d7f027 /lib/JWebmail/Plugin | |
parent | 76933635af54fb97fdc8e592e074cc4e5a262f52 (diff) |
use mojo tempdir function
Diffstat (limited to 'lib/JWebmail/Plugin')
-rw-r--r-- | lib/JWebmail/Plugin/ServerSideSessionData.pm | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/JWebmail/Plugin/ServerSideSessionData.pm b/lib/JWebmail/Plugin/ServerSideSessionData.pm index c28f6d1..16b68b1 100644 --- a/lib/JWebmail/Plugin/ServerSideSessionData.pm +++ b/lib/JWebmail/Plugin/ServerSideSessionData.pm @@ -6,7 +6,7 @@ use Fcntl qw(:DEFAULT :seek); use Time::HiRes 'sleep'; use Mojo::JSON qw(decode_json encode_json); -use Mojo::File; +use Mojo::File 'tempdir'; use constant { @@ -138,7 +138,11 @@ sub register { my ($self, $app, $conf) = @_; $conf //= {}; - $self->session_directory(Mojo::File->new($conf->{directory} || "/tmp/" . $app->moniker)); + $self->session_directory( + $conf->{directory} + ? Mojo::File->new($conf->{directory}) + : tempdir($app->moniker.'_XXXXXXXXXX', TMPDIR => 1) + ); $self->expiration($conf->{expiration} || $app->sessions->default_expiration); $self->cleanup_interval($conf->{cleanup_interval} || $self->expiration); |