Skip to content

Commit

Permalink
Merge pull request #273 from sagikazarmark/fix-panic
Browse files Browse the repository at this point in the history
fix: uninitialized logger causing panic
  • Loading branch information
sagikazarmark authored Jan 31, 2024
2 parents 20576e0 + e1a56ed commit dbf461e
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions module.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,6 @@ type FS struct {
// DEPRECATED: please use 'use_path_style' instead.
// Set this to `true` to force the request to use path-style addressing.
S3ForcePathStyle bool `json:"force_path_style,omitempty"`

logger *zap.Logger
}

// CaddyModule returns the Caddy module information.
Expand All @@ -63,7 +61,7 @@ func (fs *FS) Provision(ctx caddy.Context) error {
}

if fs.S3ForcePathStyle {
fs.logger.Warn("force_path_style is deprecated, please use use_path_style instead")
ctx.Logger().Warn("force_path_style is deprecated, please use use_path_style instead")
}

var configOpts []func(*config.LoadOptions) error
Expand All @@ -78,7 +76,8 @@ func (fs *FS) Provision(ctx caddy.Context) error {

cfg, err := config.LoadDefaultConfig(ctx.Context, configOpts...)
if err != nil {
fs.logger.Error("could not create AWS config", zap.Error(err))
ctx.Logger().Error("could not create AWS config", zap.Error(err))

return err
}

Expand Down

0 comments on commit dbf461e

Please sign in to comment.