aboutsummaryrefslogtreecommitdiff
path: root/cmd/acme/config.go
diff options
context:
space:
mode:
authorDimitri Sokolyuk <demon@dim13.org>2016-01-07 18:37:29 +0100
committerDimitri Sokolyuk <demon@dim13.org>2016-01-07 18:37:29 +0100
commit3b8e9fb44d3d1c91ab457bffbbf99e433df68312 (patch)
tree189a72e9ceb61dedf8d23bd793caa58d80ff5399 /cmd/acme/config.go
parenta52095ab5024fe0e44179ad558f59cdbe389910d (diff)
Remove old code
Diffstat (limited to 'cmd/acme/config.go')
-rw-r--r--cmd/acme/config.go45
1 files changed, 12 insertions, 33 deletions
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 {