diff options
author | Sergey Poznyakoff <gray@gnu.org> | 2018-04-19 17:03:01 +0300 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org> | 2018-04-19 17:04:40 +0300 |
commit | 3c4af35e7ef01f33662e515859a827091774d64a (patch) | |
tree | d8636f9b1ad25f1713a924f169803034321e20af | |
parent | c7c75b0cca25ecacad0ba2dfe7c41db836a0b17a (diff) | |
download | acmeman-3c4af35e7ef01f33662e515859a827091774d64a.tar.gz acmeman-3c4af35e7ef01f33662e515859a827091774d64a.tar.bz2 |
Make sure configuration defaults are applied and syntax rechecked after configuring file source module.
* acmeman: Call finalize after modifying configuration.
* lib/App/Acmeman/Config.pm (finalize): New method.
(new): Call finalize.
-rwxr-xr-x | acmeman | 9 | ||||
-rw-r--r-- | lib/App/Acmeman/Config.pm | 8 |
2 files changed, 11 insertions, 6 deletions
@@ -1,7 +1,7 @@ | |||
1 | #!/bin/sh | 1 | #!/bin/sh |
2 | #!-*-perl-*- | 2 | #! -*-perl-*- |
3 | eval 'exec /usr/bin/perl -S $0 ${1+"$@"}' | 3 | eval 'exec perl -x -wS $0 ${1+"$@"}' |
4 | if 0; # not running under some shell | 4 | if 0; |
5 | # Copyright (C) 2017, 2018 Sergey Poznyakoff <gray@gnu.org> | 5 | # Copyright (C) 2017, 2018 Sergey Poznyakoff <gray@gnu.org> |
6 | # | 6 | # |
7 | # This program is free software; you can redistribute it and/or modify | 7 | # This program is free software; you can redistribute it and/or modify |
@@ -563,7 +563,7 @@ Sergey Poznyakoff <gray@gnu.org> | |||
563 | 563 | ||
564 | my $progname = basename($0); | 564 | my $progname = basename($0); |
565 | my $progdescr = "manages ACME certificates"; | 565 | my $progdescr = "manages ACME certificates"; |
566 | my $debug; | 566 | my $debug = 0; |
567 | my $dry_run; | 567 | my $dry_run; |
568 | my $acme_host = 'prod'; | 568 | my $acme_host = 'prod'; |
569 | my %acme_endpoint = (prod => 'acme-v01.api.letsencrypt.org', | 569 | my %acme_endpoint = (prod => 'acme-v01.api.letsencrypt.org', |
@@ -1182,6 +1182,7 @@ if ($config->success) { | |||
1182 | if ($check_alt_names) { | 1182 | if ($check_alt_names) { |
1183 | $config->set(qw(core check-alt-names), $check_alt_names); | 1183 | $config->set(qw(core check-alt-names), $check_alt_names); |
1184 | } | 1184 | } |
1185 | $config->finalize; | ||
1185 | } | 1186 | } |
1186 | 1187 | ||
1187 | unless ($config->success) { | 1188 | unless ($config->success) { |
diff --git a/lib/App/Acmeman/Config.pm b/lib/App/Acmeman/Config.pm index bbe1f2b..614a46a 100644 --- a/lib/App/Acmeman/Config.pm +++ b/lib/App/Acmeman/Config.pm | |||
@@ -30,11 +30,15 @@ sub new { | |||
30 | } else { | 30 | } else { |
31 | $self->error("configuration file \"$filename\" does not exist"); | 31 | $self->error("configuration file \"$filename\" does not exist"); |
32 | } | 32 | } |
33 | 33 | $self->finalize; | |
34 | return $self; | ||
35 | } | ||
36 | |||
37 | sub finalize { | ||
38 | my $self = shift; | ||
34 | if ($self->success && exists($self->{_syntax})) { | 39 | if ($self->success && exists($self->{_syntax})) { |
35 | $self->_fixup($self->{_syntax}, $self->{_conf}); | 40 | $self->_fixup($self->{_syntax}, $self->{_conf}); |
36 | } | 41 | } |
37 | return $self; | ||
38 | } | 42 | } |
39 | 43 | ||
40 | sub error { | 44 | sub error { |