Skip to content

Commit

Permalink
Merge pull request #74 from rekby/devel
Browse files Browse the repository at this point in the history
Fix test server flag
Some improve log messages about cache miss
  • Loading branch information
rekby authored Jul 10, 2019
2 parents 0fabbe7 + d511cc9 commit 060fb91
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion cmd/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ func getConfig(ctx context.Context) *configType {
func applyFlags(ctx context.Context, config *configType) {
if *testAcmeServerP {
zc.L(ctx).Info("Set test acme server by command line flag")
config.General.AcmeServer = "https://acme-staging-v02.api.letsencrypt.org/directory"
config.General.AcmeServer = "https://acme-staging.api.letsencrypt.org/directory"
}
}

Expand Down
6 changes: 4 additions & 2 deletions internal/cache/disk.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,14 @@ func (c *DiskCache) Get(ctx context.Context, key string) ([]byte, error) {
c.mu.RLock()
defer c.mu.RUnlock()

res, err := ioutil.ReadFile(c.filepath(key))
filePath := c.filepath(key)
res, err := ioutil.ReadFile(filePath)
if os.IsNotExist(err) {
err = ErrCacheMiss
}

zc.L(ctx).Debug("Got from disk cache", zap.String("dir", c.Dir), zap.String("key", key), zap.Error(err))
zc.L(ctx).Debug("Got from disk cache", zap.String("dir", c.Dir), zap.String("key", key),
zap.String("file", filePath), zap.Error(err))
return res, err
}

Expand Down
2 changes: 1 addition & 1 deletion internal/cache/interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"errors"
)

var ErrCacheMiss = errors.New("lets proxy: certificate cache miss")
var ErrCacheMiss = errors.New("lets proxy: cache miss")

type Cache interface {
// Get returns a certificate data for the specified key.
Expand Down

0 comments on commit 060fb91

Please sign in to comment.