From 628920e20e2d60933fe0e9b39ad0888a7b1ef915 Mon Sep 17 00:00:00 2001 From: Matthew Holt Date: Tue, 23 Aug 2016 14:51:07 -0600 Subject: [PATCH] Improve logic related to error handling on SiteExists call No need to check if SiteExists if the config is not managed or the name does not even qualify. --- caddytls/config.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/caddytls/config.go b/caddytls/config.go index ab793552..18cb8d21 100644 --- a/caddytls/config.go +++ b/caddytls/config.go @@ -133,6 +133,10 @@ func (c *Config) ObtainCert(allowPrompts bool) error { } func (c *Config) obtainCertName(name string, allowPrompts bool) error { + if !c.Managed || !HostQualifies(name) { + return nil + } + storage, err := c.StorageFor(c.CAUrl) if err != nil { return err @@ -143,7 +147,7 @@ func (c *Config) obtainCertName(name string, allowPrompts bool) error { return err } - if !c.Managed || !HostQualifies(name) || siteExists { + if siteExists { return nil }