Skip to content

Commit

Permalink
Make storage check optional (close caddyserver#201)
Browse files Browse the repository at this point in the history
Not a good idea most of the time though.
  • Loading branch information
mholt authored and ankon committed May 11, 2023
1 parent 0792c19 commit cc310f1
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions config.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,16 @@ type Config struct {
// TLS assets. Default is the local file system.
Storage Storage

// CertMagic will verify the storage configuration
// is acceptable before obtaining a certificate
// to avoid information loss after an expensive
// operation. If you are absolutely 100% sure your
// storage is properly configured and has sufficient
// space, you can disable this check to reduce I/O
// if that is expensive for you.
// EXPERIMENTAL: Option subject to change or removal.
DisableStorageCheck bool

// Set a logger to enable logging. If not set,
// a default logger will be created.
Logger *zap.Logger
Expand Down Expand Up @@ -1000,6 +1010,9 @@ func (cfg *Config) getChallengeInfo(ctx context.Context, identifier string) (Cha
// comparing the loaded value. If this fails, the provided
// cfg.Storage mechanism should not be used.
func (cfg *Config) checkStorage(ctx context.Context) error {
if cfg.DisableStorageCheck {
return nil
}
key := fmt.Sprintf("rw_test_%d", weakrand.Int())
contents := make([]byte, 1024*10) // size sufficient for one or two ACME resources
_, err := weakrand.Read(contents)
Expand Down

0 comments on commit cc310f1

Please sign in to comment.