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.go18
1 files changed, 11 insertions, 7 deletions
diff --git a/cmd/acme/config.go b/cmd/acme/config.go
index 6ad4ca5..ad2df73 100644
--- a/cmd/acme/config.go
+++ b/cmd/acme/config.go
@@ -2,13 +2,13 @@ package main
import (
"errors"
+ "io/ioutil"
"path"
"strings"
"time"
"dim13.org/acme"
-
- "github.com/BurntSushi/toml"
+ "gopkg.in/yaml.v2"
)
const defKeySize = 2048
@@ -22,7 +22,7 @@ type Config struct {
}
type defaults struct {
- Gracetime duration
+ Gracetime
Listen string
ListenTLS string
Provider string
@@ -75,7 +75,11 @@ var (
func LoadConfig(fname string) (*Config, error) {
c := &Config{}
- _, err := toml.DecodeFile(fname, c)
+ conf, err := ioutil.ReadFile(fname)
+ if err != nil {
+ return nil, err
+ }
+ err = yaml.Unmarshal(conf, c)
if err != nil {
return nil, err
}
@@ -142,10 +146,10 @@ func LoadConfig(fname string) (*Config, error) {
return c, nil
}
-type duration struct{ time.Duration }
+type Gracetime struct{ time.Duration }
-func (d *duration) UnmarshalText(s []byte) error {
+func (g *Gracetime) UnmarshalText(s []byte) error {
var err error
- d.Duration, err = time.ParseDuration(string(s))
+ g.Duration, err = time.ParseDuration(string(s))
return err
}