aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDimitri Sokolyuk <demon@dim13.org>2015-12-17 01:11:23 +0100
committerDimitri Sokolyuk <demon@dim13.org>2015-12-17 01:11:23 +0100
commit91cc9d2f53932f42afe89245f346a97b45edda9f (patch)
tree5ada37798fcbb7097a4103d2d213457c9409c6a7
parent91ec946e226e2b3665f296731ad34b23154cacab (diff)
Add duration type
-rw-r--r--acme.toml2
-rw-r--r--cmd/acmed/config.go11
-rw-r--r--cmd/acmed/main.go3
3 files changed, 14 insertions, 2 deletions
diff --git a/acme.toml b/acme.toml
index 936c8d9..2c65156 100644
--- a/acme.toml
+++ b/acme.toml
@@ -1,5 +1,5 @@
[defaults]
-gracetime = "1 week"
+gracetime = "10080h" # 1 week
listen = "localhost:8443"
basedir = ".acme" # usually "/etc/ssl"
provider = "les"
diff --git a/cmd/acmed/config.go b/cmd/acmed/config.go
index cc95557..284ae61 100644
--- a/cmd/acmed/config.go
+++ b/cmd/acmed/config.go
@@ -5,6 +5,7 @@ import (
"errors"
"path"
"strings"
+ "time"
"github.com/BurntSushi/toml"
)
@@ -18,7 +19,7 @@ type Config struct {
}
type defaults struct {
- Gracetime string
+ Gracetime duration
Listen string
Provider string
Account string
@@ -139,3 +140,11 @@ func (d desire) Path() string { return d.Key }
func (d desire) Size() int { return d.KeySize }
func (a account) Path() string { return a.Key }
func (a account) Size() int { return a.KeySize }
+
+type duration struct{ time.Duration }
+
+func (d *duration) UnmarshalText(s []byte) error {
+ var err error
+ d.Duration, err = time.ParseDuration(string(s))
+ return err
+}
diff --git a/cmd/acmed/main.go b/cmd/acmed/main.go
index abf560f..6963238 100644
--- a/cmd/acmed/main.go
+++ b/cmd/acmed/main.go
@@ -76,6 +76,9 @@ func main() {
conf.Desire[k] = des
}
+ log.Println(conf)
+ return
+
for k, des := range conf.Desire {
a, _ := acme.NewAccount(des.account.Mail, des.account.Phone, des.account.key)
log.Println(k, a)