From 474c029149bfa712dc6cbc2918215d430a937a63 Mon Sep 17 00:00:00 2001 From: Dimitri Sokolyuk Date: Fri, 18 Dec 2015 19:05:17 +0100 Subject: Refactor keysize --- cmd/acme/config.go | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) (limited to 'cmd/acme/config.go') diff --git a/cmd/acme/config.go b/cmd/acme/config.go index d9d6200..b5bc433 100644 --- a/cmd/acme/config.go +++ b/cmd/acme/config.go @@ -26,7 +26,7 @@ type defaults struct { Provider string Account string Basedir string - KeySize int + Size int } type provider struct { @@ -34,11 +34,11 @@ type provider struct { } type account struct { - Mail string - Phone string - KeySize int - Key string - key *rsa.PrivateKey + Mail string + Phone string + Size int + Key string + key *rsa.PrivateKey } type hook struct { @@ -49,7 +49,7 @@ type desire struct { Provider string Account string Altnames []string - KeySize int + Size int Key string Cert string Webroot string @@ -77,12 +77,12 @@ func LoadConfig(fname string) (*Config, error) { return nil, err } // apply defaults - if c.Defaults.KeySize == 0 { - c.Defaults.KeySize = 2048 + if c.Defaults.Size == 0 { + c.Defaults.Size = 2048 } for k, v := range c.Account { - if v.KeySize == 0 { - v.KeySize = c.Defaults.KeySize + if v.Size == 0 { + v.Size = c.Defaults.Size } if v.Mail == "" { return nil, errNoMail @@ -112,8 +112,8 @@ func LoadConfig(fname string) (*Config, error) { } } v.account = c.Account[v.Account] - if v.KeySize == 0 { - v.KeySize = c.Defaults.KeySize + if v.Size == 0 { + v.Size = c.Defaults.Size } if v.Key == "" { return nil, errNoKey @@ -141,7 +141,7 @@ func LoadConfig(fname string) (*Config, error) { type PrivKey interface { KeyPath() string - Size() int + KeySize() int KeyExists() bool } @@ -159,12 +159,12 @@ func exists(fname string) bool { func (d desire) CertPath() string { return d.Cert } func (d desire) KeyPath() string { return d.Key } -func (d desire) Size() int { return d.KeySize } +func (d desire) KeySize() int { return d.Size } func (d desire) KeyExists() bool { return exists(d.Key) } func (d desire) CertExists() bool { return exists(d.Cert) } func (a account) KeyPath() string { return a.Key } -func (a account) Size() int { return a.KeySize } +func (a account) KeySize() int { return a.Size } func (a account) KeyExists() bool { return exists(a.Key) } type duration struct{ time.Duration } -- cgit v1.2.3