From 3b8e9fb44d3d1c91ab457bffbbf99e433df68312 Mon Sep 17 00:00:00 2001 From: Dimitri Sokolyuk Date: Thu, 7 Jan 2016 18:37:29 +0100 Subject: Remove old code --- cmd/acme/config.go | 45 ++++++++++++--------------------------------- 1 file changed, 12 insertions(+), 33 deletions(-) (limited to 'cmd/acme/config.go') diff --git a/cmd/acme/config.go b/cmd/acme/config.go index eca8117..0dd396c 100644 --- a/cmd/acme/config.go +++ b/cmd/acme/config.go @@ -29,7 +29,7 @@ type defaults struct { Provider string Account string Basedir string - Size int + KeySize int } type provider struct { @@ -38,10 +38,10 @@ type provider struct { } type account struct { - Mail string - Phone string - Size int - Key string + Mail string + Phone string + KeySize int + Key string *acme.Account acme.Contacts } @@ -54,7 +54,7 @@ type desire struct { Provider string Account string Altnames []string - Size int + KeySize int Key string Cert string Webroot string @@ -80,8 +80,8 @@ func LoadConfig(fname string) (*Config, error) { return nil, err } // apply defaults - if c.Defaults.Size == 0 { - c.Defaults.Size = defKeySize + if c.Defaults.KeySize == 0 { + c.Defaults.KeySize = defKeySize } if c.Defaults.Listen == "" { c.Defaults.Listen = "localhost:8080" @@ -90,8 +90,8 @@ func LoadConfig(fname string) (*Config, error) { c.Defaults.ListenTLS = c.Defaults.Listen } for k, v := range c.Account { - if v.Size == 0 { - v.Size = c.Defaults.Size + if v.KeySize == 0 { + v.KeySize = c.Defaults.KeySize } if v.Mail == "" { return nil, errNoMail @@ -121,8 +121,8 @@ func LoadConfig(fname string) (*Config, error) { } } v.account = c.Account[v.Account] - if v.Size == 0 { - v.Size = c.Defaults.Size + if v.KeySize == 0 { + v.KeySize = c.Defaults.KeySize } if v.Key == "" { return nil, errNoKey @@ -148,17 +148,6 @@ func LoadConfig(fname string) (*Config, error) { return c, nil } -type PrivKey interface { - KeyPath() string - KeySize() int - HasKey() bool -} - -type Cert interface { - CertPath() string - HasCert() bool -} - func exists(fname string) bool { if _, err := os.Stat(fname); os.IsNotExist(err) { return false @@ -166,16 +155,6 @@ func exists(fname string) bool { return true } -func (d desire) CertPath() string { return d.Cert } -func (d desire) KeyPath() string { return d.Key } -func (d desire) KeySize() int { return d.Size } -func (d desire) HasKey() bool { return exists(d.Key) } -func (d desire) HasCert() bool { return exists(d.Cert) } - -func (a account) KeyPath() string { return a.Key } -func (a account) KeySize() int { return a.Size } -func (a account) HasKey() bool { return exists(a.Key) } - type duration struct{ time.Duration } func (d *duration) UnmarshalText(s []byte) error { -- cgit v1.2.3