aboutsummaryrefslogtreecommitdiff
path: root/cmd/acme/config.go
diff options
context:
space:
mode:
Diffstat (limited to 'cmd/acme/config.go')
-rw-r--r--cmd/acme/config.go13
1 files changed, 10 insertions, 3 deletions
diff --git a/cmd/acme/config.go b/cmd/acme/config.go
index 102eb0c..e099b82 100644
--- a/cmd/acme/config.go
+++ b/cmd/acme/config.go
@@ -118,17 +118,20 @@ func LoadConfig(fname string) (*Config, error) {
if dom.KeySize == 0 {
dom.KeySize = c.KeySize
}
+ if len(dom.Altnames) == 0 {
+ return nil, errNoAltNames
+ }
+ dom.Altnames = checkWWW(dom.Altnames)
if dom.KeyFile == "" {
- return nil, errNoKey
+ dom.KeyFile = replace(dom.Altnames[0]) + ".pem"
}
if dom.CrtFile == "" {
- return nil, errNoCrt
+ dom.CrtFile = replace(dom.Altnames[0]) + ".pem"
}
if c.BaseDir != "" {
dom.KeyFile = path.Join(c.BaseDir, dom.KeyFile)
dom.CrtFile = path.Join(c.BaseDir, dom.CrtFile)
}
- dom.Altnames = checkWWW(dom.Altnames)
acc.Domain[i] = dom
}
}
@@ -137,6 +140,10 @@ func LoadConfig(fname string) (*Config, error) {
return c, nil
}
+func replace(s string) string {
+ return strings.Replace(s, ".", "_", -1)
+}
+
func checkWWW(altnames []string) []string {
ch := make(chan string)
go func(ch chan string, s []string) {