fixup some acme related things
This commit is contained in:
parent
82f94c7861
commit
3fc04f4dff
@ -13,7 +13,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type certmagicProvider struct {
|
type certmagicProvider struct {
|
||||||
opts *acme.Options
|
opts acme.Options
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *certmagicProvider) NewListener(ACMEHosts ...string) (net.Listener, error) {
|
func (c *certmagicProvider) NewListener(ACMEHosts ...string) (net.Listener, error) {
|
||||||
@ -40,23 +40,19 @@ func (c *certmagicProvider) NewListener(ACMEHosts ...string) (net.Listener, erro
|
|||||||
|
|
||||||
// New returns a certmagic provider
|
// New returns a certmagic provider
|
||||||
func New(options ...acme.Option) acme.Provider {
|
func New(options ...acme.Option) acme.Provider {
|
||||||
o := &acme.Options{}
|
opts := acme.DefaultOptions()
|
||||||
if len(options) == 0 {
|
|
||||||
for _, op := range acme.Default() {
|
for _, o := range options {
|
||||||
op(o)
|
o(&opts)
|
||||||
}
|
|
||||||
} else {
|
|
||||||
for _, op := range options {
|
|
||||||
op(o)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if o.Cache != nil {
|
|
||||||
if _, ok := o.Cache.(certmagic.Storage); !ok {
|
if opts.Cache != nil {
|
||||||
|
if _, ok := opts.Cache.(certmagic.Storage); !ok {
|
||||||
log.Fatal("ACME: cache provided doesn't implement certmagic's Storage interface")
|
log.Fatal("ACME: cache provided doesn't implement certmagic's Storage interface")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return &certmagicProvider{
|
return &certmagicProvider{
|
||||||
opts: o,
|
opts: opts,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -89,7 +89,7 @@ func (s *storage) Exists(key string) bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *storage) List(prefix string, recursive bool) ([]string, error) {
|
func (s *storage) List(prefix string, recursive bool) ([]string, error) {
|
||||||
records, err := s.store.Sync()
|
records, err := s.store.List()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
@ -63,11 +63,11 @@ func Cache(c interface{}) Option {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Default uses the Let's Encrypt Production CA, with DNS Challenge disabled.
|
// DefaultOptions uses the Let's Encrypt Production CA, with DNS Challenge disabled.
|
||||||
func Default() []Option {
|
func DefaultOptions() Options {
|
||||||
return []Option{
|
return Options{
|
||||||
AcceptToS(true),
|
AcceptToS: true,
|
||||||
CA(LetsEncryptProductionCA),
|
CA: LetsEncryptProductionCA,
|
||||||
OnDemand(true),
|
OnDemand: true,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user