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