From f4cc1699a661197450f86a61f7c53e9c0b96bef1 Mon Sep 17 00:00:00 2001 From: Dimitri Sokolyuk Date: Sun, 27 Dec 2015 03:15:26 +0100 Subject: bikeshading --- cmd/acme/config.go | 11 ++++++----- cmd/acme/main.go | 4 ++-- 2 files changed, 8 insertions(+), 7 deletions(-) (limited to 'cmd') diff --git a/cmd/acme/config.go b/cmd/acme/config.go index 1180f16..41561f4 100644 --- a/cmd/acme/config.go +++ b/cmd/acme/config.go @@ -25,6 +25,7 @@ type Config struct { type defaults struct { Gracetime duration Listen string + ListenTLS string Provider string Account string Basedir string @@ -143,12 +144,12 @@ func LoadConfig(fname string) (*Config, error) { type PrivKey interface { KeyPath() string KeySize() int - KeyExists() bool + HasKey() bool } type Cert interface { CertPath() string - CertExists() bool + HasCert() bool } func exists(fname string) bool { @@ -161,12 +162,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) KeySize() int { return d.Size } -func (d desire) KeyExists() bool { return exists(d.Key) } -func (d desire) CertExists() bool { return exists(d.Cert) } +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) KeyExists() bool { return exists(a.Key) } +func (a account) HasCert() bool { return exists(a.Key) } type duration struct{ time.Duration } diff --git a/cmd/acme/main.go b/cmd/acme/main.go index 2124666..bf05ce9 100644 --- a/cmd/acme/main.go +++ b/cmd/acme/main.go @@ -15,7 +15,7 @@ var confName = flag.String("conf", "acme.toml", "configuration file") func chkKey(k PrivKey) (*rsa.PrivateKey, error) { key := k.KeyPath() - if k.KeyExists() { + if k.HasKey() { fd, err := os.Open(key) if err != nil { return nil, err @@ -37,7 +37,7 @@ func chkKey(k PrivKey) (*rsa.PrivateKey, error) { } func chkCert(k Cert) error { - if !k.CertExists() { + if !k.HasCert() { return errors.New("cert missing") } return nil -- cgit v1.2.3