aboutsummaryrefslogtreecommitdiff
path: root/cmd/acme/config.go
diff options
context:
space:
mode:
authorDimitri Sokolyuk <demon@dim13.org>2016-02-29 19:49:34 +0100
committerDimitri Sokolyuk <demon@dim13.org>2016-02-29 19:49:34 +0100
commit5089cb612a18c284cd2721ded51fbebb7faf1498 (patch)
tree985ad78effdd281014027da1bf90559b6da3fb13 /cmd/acme/config.go
parentc67bb0e887ec625dc0ae5ab42b5b9d4a15380271 (diff)
Back to normal
Diffstat (limited to 'cmd/acme/config.go')
-rw-r--r--cmd/acme/config.go20
1 files changed, 11 insertions, 9 deletions
diff --git a/cmd/acme/config.go b/cmd/acme/config.go
index 176891e..8aad4fa 100644
--- a/cmd/acme/config.go
+++ b/cmd/acme/config.go
@@ -144,18 +144,20 @@ func LoadConfig(fname string) (*Config, error) {
return c, nil
}
-func (c *Config) Mkdirs() error {
- key := keyPath
- crt := crtPath
- if c.BaseDir != "" {
- key = path.Join(c.BaseDir, keyPath)
- crt = path.Join(c.BaseDir, crtPath)
- }
- err := os.MkdirAll(key, 0700)
+type Dirmaker interface {
+ Mkdirs() error
+}
+
+func (a account) Mkdirs() error {
+ return os.MkdirAll(path.Dir(a.KeyFile), 0700)
+}
+
+func (d domain) Mkdirs() error {
+ err := os.MkdirAll(path.Dir(d.KeyFile), 0700)
if err != nil {
return err
}
- return os.MkdirAll(crt, 0755)
+ return os.MkdirAll(path.Dir(d.CrtFile), 0755)
}
func replace(s string) string {