aboutsummaryrefslogtreecommitdiff
path: root/cmd/acme/config.go
diff options
context:
space:
mode:
authorDimitri Sokolyuk <demon@dim13.org>2015-12-18 19:05:17 +0100
committerDimitri Sokolyuk <demon@dim13.org>2015-12-18 19:05:17 +0100
commit474c029149bfa712dc6cbc2918215d430a937a63 (patch)
treeedd650202f5693d73a2c02f96c2a13b3afbcea0f /cmd/acme/config.go
parent8ce6e8dd325c658b3ca49a5de6c7540a72ec3fb5 (diff)
Refactor keysize
Diffstat (limited to 'cmd/acme/config.go')
-rw-r--r--cmd/acme/config.go32
1 files changed, 16 insertions, 16 deletions
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 }