summaryrefslogtreecommitdiff
path: root/lib/JWebmail.pm
diff options
context:
space:
mode:
authorJannis M. Hoffmann <jannis@fehcom.de>2023-09-08 23:32:10 +0200
committerJannis M. Hoffmann <jannis@fehcom.de>2023-09-08 23:32:10 +0200
commit926ec7a6b85e6e3f7335a8c5ddcccd51937ee2d8 (patch)
treeb7a420a919d0146f2a0bd2e1e577b795fcb99202 /lib/JWebmail.pm
parent4510e3720274865996ef056f1687997ba0b482be (diff)
added a build configuration step
Diffstat (limited to 'lib/JWebmail.pm')
-rw-r--r--lib/JWebmail.pm37
1 files changed, 15 insertions, 22 deletions
diff --git a/lib/JWebmail.pm b/lib/JWebmail.pm
index e2c291c..993ad59 100644
--- a/lib/JWebmail.pm
+++ b/lib/JWebmail.pm
@@ -8,6 +8,7 @@ use JWebmail::Controller::Webmail;
use JWebmail::Model::ReadMails::Role;
use JWebmail::Model::ReadMails::QMailAuthuser;
use JWebmail::Model::WriteMails;
+use JWebmail::Config qw'LOGIN_SCHEME MAILDIR_READER';
sub validateConf {
@@ -15,11 +16,16 @@ sub validateConf {
my $conf = $self->config;
- exists $conf->{session}{secure} or die;
- grep(sub { $_ eq $conf->{session}{secure} }, qw(none cram s3d)) > 0 or die;
+ exists $conf->{admin_mail} or die;
+ $conf->{admin_mail} =~ /@/ or die;
- exists $conf->{defaults}{scriptadmin} or die;
- $conf->{defaults}{scriptadmin} =~ /@/ or die;
+ exists $conf->{i18n}{default_language} or die;
+ $conf->{i18n}{default_language} =~ /^[\w_]+$/a or die;
+
+ exists $conf->{model}{read}{virtual_user} or die;
+ getpwnam $conf->{model}{read}{virtual_user} or die;
+ exists $conf->{model}{read}{mailbox_path} or die;
+ -d $conf->{model}{read}{mailbox_path} or die;
return 1;
}
@@ -36,11 +42,7 @@ sub startup {
$self->plugin('TOMLConfig');
$self->validateConf;
- if (my $logpath = $self->config('logpath')) {
- $self->log->path($logpath . '/' . $self->mode . '.log');
- }
-
- if (fc $self->config->{session}{secure} eq fc 's3d') {
+ if (fc LOGIN_SCHEME eq fc 's3d') {
$self->plugin('ServerSideSessionData');
}
$self->plugin('Paginate');
@@ -51,23 +53,14 @@ sub startup {
# initialize models
my $read_mails = do {
- if ($self->mode eq 'development') {
- my $cls = $self->config->{model}{read}{devel}{driver};
- eval { load $cls; 1 } || die "Issue for module $cls with: $@";
- $cls->new(($self->config->{model}{read}{devel} // {})->%*)
- }
- else {
- JWebmail::Model::ReadMails::QMailAuthuser->new(
- ($self->config->{model}{read}{prod} // {})->%*
- )
- }
+ my $cls = MAILDIR_READER;
+ eval { load $cls; 1 } || die "Issue for module $cls with: $@";
+ $cls->new(($self->config->{model}{read} // {})->%*)
};
die "given class @{[ ref $read_mails ]} does not ReadMails"
unless $read_mails->DOES('JWebmail::Model::ReadMails::Role');
$self->helper(users => sub { $read_mails });
$self->helper(send_mail => sub { my ($c, $mail) = @_; JWebmail::Model::WriteMails::sendmail($mail) });
- $JWebmail::Model::WriteMails::Block_Writes = 1
- if $self->mode eq 'development' && $self->config->{model}{write}{devel}{block_writes};
$self->validator->add_check(mail_line => \&_mail_line);
$self->validator->add_filter(non_empty_ul => \&_filter_empty_upload);
@@ -149,7 +142,7 @@ JWebmail - Provides a web based e-mail client meant to be used with s/qmail.
hypnotoad script/jwebmail
-And use a server in reverse proxy configuration.
+And use a server in reverse proxy configuration.
=head1 DESCRIPTION