diff --git a/root/etc/e-smith/templates/etc/letsencrypt.sh/domains.txt/10domains b/root/etc/e-smith/templates/etc/letsencrypt.sh/domains.txt/10domains index 9f2669e..9033a14 100644 --- a/root/etc/e-smith/templates/etc/letsencrypt.sh/domains.txt/10domains +++ b/root/etc/e-smith/templates/etc/letsencrypt.sh/domains.txt/10domains @@ -7,12 +7,17 @@ use List::MoreUtils qw(uniq); my $d = esmith::DomainsDB->open_ro || die "Couldn't open DomainsDB\n"; my $h = esmith::HostsDB->open_ro || die "Couldn't open HostsDB\n"; -my @names = ( "$DomainName" ); +my @names = (); foreach my $domain ($d->domains, $d->get_all_by_prop(type => 'vhost')){ - next if ($domain->key eq $DomainName); my $le = $domain->prop('Letsencrypt') || 'enabled'; - push @names, $domain->key unless $le ne 'enabled'; + next if ($le ne 'enabled'); + if ($domain->key eq $DomainName){ + unshift @names, $DomainName; + } + else{ + push @names, $domain->key; + } } foreach my $host ($h->hosts){