Skip to content

Storage check -- can it be removed? #201

Closed
@ankon

Description

@ankon

certmagic/config.go

Lines 456 to 461 in 76f61c2

// ensure storage is writeable and readable
// TODO: this is not necessary every time; should only perform check once every so often for each storage, which may require some global state...
err := cfg.checkStorage(ctx)
if err != nil {
return fmt.Errorf("failed storage check: %v - storage is probably misconfigured", err)
}

Depending on the storage this check can be quite expensive (in our case a remote KV store), and it happens in a rather "hot" area: Right when setting up a TLS connection. If we need to get a certificate from a CA this doesn't matter too much in the grand scheme of things, but if our storage has one we triple our roundtrips (1 to get the cert information from storage, and 2 for a write/read from storage to check it).

I think this check might have some value, but not here:

  • If the storage is generally trustworthy, it should be checked before it gets configured for certmagic
  • If the storage is generally untrustworthy and needs regular checks, it should be part of that specific storage

So, I'd propose to just drop these lines here, and possibly move the implementation of checkStorage as an example into documentation. WDYT?

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature requestRequest for new feature or functionality

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions