aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org>2018-04-19 17:03:01 +0300
committerSergey Poznyakoff <gray@gnu.org>2018-04-19 17:04:40 +0300
commit3c4af35e7ef01f33662e515859a827091774d64a (patch)
treed8636f9b1ad25f1713a924f169803034321e20af
parentc7c75b0cca25ecacad0ba2dfe7c41db836a0b17a (diff)
downloadacmeman-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-xacmeman9
-rw-r--r--lib/App/Acmeman/Config.pm8
2 files changed, 11 insertions, 6 deletions
diff --git a/acmeman b/acmeman
index 37ed4dd..f21aa70 100755
--- a/acmeman
+++ b/acmeman
@@ -1,7 +1,7 @@
1#!/bin/sh 1#!/bin/sh
2#!-*-perl-*- 2#! -*-perl-*-
3eval 'exec /usr/bin/perl -S $0 ${1+"$@"}' 3eval '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
564my $progname = basename($0); 564my $progname = basename($0);
565my $progdescr = "manages ACME certificates"; 565my $progdescr = "manages ACME certificates";
566my $debug; 566my $debug = 0;
567my $dry_run; 567my $dry_run;
568my $acme_host = 'prod'; 568my $acme_host = 'prod';
569my %acme_endpoint = (prod => 'acme-v01.api.letsencrypt.org', 569my %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
1187unless ($config->success) { 1188unless ($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
37sub 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
40sub error { 44sub error {

Return to:

Send suggestions and report system problems to the System administrator.