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.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 {