Skip to content
Snippets Groups Projects
Commit 6ce8843c authored by Guillaume ROUSSE's avatar Guillaume ROUSSE
Browse files

add multiple early configuration sanity checks

parent 08c1f579
No related branches found
No related tags found
No related merge requests found
......@@ -13,6 +13,16 @@ my $configuration_file =
$ENV{ACCOUNTMANAGER_CONFIG} || '@sysconfdir@/manager.conf';
my $configuration = Config::Tiny->read($configuration_file);
# configuration sanity check
die "no database defined in configuration, aborting\n"
unless $configuration->{database};
die "no mailer defined in configuration, aborting\n"
unless $configuration->{mailer};
die "no idp defined in configuration, aborting\n"
unless $configuration->{idp};
warn "no logger in configuration, logging disabled\n"
unless $configuration->{logger};
my $app = AccountManager::App->new(
configuration => $configuration
);
......
......@@ -18,7 +18,7 @@ federation_metadata_file = @sysconfdir@/edugain-md.xml
file = /opt/testidp/IdPAccountManager/log/manager.log
level = info
[notifier)
[mailer]
# path to sendmail executable
sendmail_path = /usr/sbin/sendmail
# from field use by the account manager
......
......@@ -44,11 +44,9 @@ sub new {
if ($self->{configuration}->{logger}) {
Log::Any::Adapter->set(
'File',
$self->{configuration}->{log}->{file},
log_level => $self->{configuration}->{log}->{level}
$self->{configuration}->{logger}->{file},
log_level => $self->{configuration}->{logger}->{level}
);
} else {
warn "no logger defined in configuration, logging disabled\n";
}
$self->{logger} = Log::Any->get_logger();
......@@ -414,8 +412,8 @@ sub req_complete_challenge {
);
}
my $sender = $self->{configuration}->{notifier}->{from};
my $sendmail = $self->{configuration}->{notifier}->{sendmail_path} ||
my $sender = $self->{configuration}->{mailer}->{from};
my $sendmail = $self->{configuration}->{mailer}->{sendmail_path} ||
'/usr/sbin/sendmail';
my $recipient = $self->{in}->{email};
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment