Skip to content

Commit

Permalink
update storage version and improve error log (#438)
Browse files Browse the repository at this point in the history
Co-authored-by: gipsh <hernangips@OnoSendai-2.local>
  • Loading branch information
gipsh and gipsh committed Jun 21, 2023
1 parent 1837a77 commit 2c476dd
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
7 changes: 2 additions & 5 deletions api/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,13 @@ require (
github.com/test-go/testify v1.1.4
)

require (
github.com/gofiber/utils v1.1.0 // indirect
github.com/redis/go-redis/v9 v9.0.5 // indirect
)
require github.com/redis/go-redis/v9 v9.0.5 // indirect

require (
contrib.go.opencensus.io/exporter/stackdriver v0.13.14 // indirect
filippo.io/edwards25519 v1.0.0 // indirect
github.com/KyleBanks/depth v1.2.1 // indirect
github.com/XLabs/fiber-redis-storage v0.1.0
github.com/XLabs/fiber-redis-storage v0.2.0
github.com/andybalholm/brotli v1.0.4 // indirect
github.com/aybabtme/rgbterm v0.0.0-20170906152045-cc83f3b3ce59 // indirect
github.com/beorn7/perks v1.0.1 // indirect
Expand Down
5 changes: 2 additions & 3 deletions api/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAE
github.com/Shopify/sarama v1.19.0/go.mod h1:FVkBWblsNy7DGZRfXLU0O9RCGt5g3g3yEuWXgklEdEo=
github.com/Shopify/toxiproxy v2.1.4+incompatible/go.mod h1:OXgGpZ6Cli1/URJOF1DMxUHB2q5Ap20/P/eIdh4G0pI=
github.com/VividCortex/gohistogram v1.0.0/go.mod h1:Pf5mBqqDxYaXu3hDrrU+w6nw50o/4+TcAqDqk/vUH7g=
github.com/XLabs/fiber-redis-storage v0.1.0 h1:/DGwyGsn4z8nAqpmLU0bNWAyMfZKpv+P6DgYqwGcZI0=
github.com/XLabs/fiber-redis-storage v0.1.0/go.mod h1:tiisgpEhK1ya5VqIiN1XVdfzyBL21ENhv458uNig6XM=
github.com/XLabs/fiber-redis-storage v0.2.0 h1:t6CrarwqrIpvGA8gaQLbYuXduUe8et/fJeaKsDPnXPE=
github.com/XLabs/fiber-redis-storage v0.2.0/go.mod h1:IVlps5AHwJc0Tq7aIwct137nnYBimaF/HJy1B9asl80=
github.com/afex/hystrix-go v0.0.0-20180502004556-fa1af6a1f4f5/go.mod h1:SkGFH1ia65gfNATL8TAiHDNxPzPdmEL5uirI2Uyuz6c=
github.com/akavel/rsrc v0.8.0/go.mod h1:uLoCtb9J+EyAqh+26kdrTgmzRBFPGOolLWKpdxkKq+c=
github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
Expand Down Expand Up @@ -245,7 +245,6 @@ github.com/gofiber/fiber/v2 v2.36.0/go.mod h1:tgCr+lierLwLoVHHO/jn3Niannv34WRkQE
github.com/gofiber/fiber/v2 v2.39.0 h1:uhWpYQ6EHN8J7FOPYbI2hrdBD/KNZBC5CjbuOd4QUt4=
github.com/gofiber/fiber/v2 v2.39.0/go.mod h1:Cmuu+elPYGqlvQvdKyjtYsjGMi69PDp8a1AY2I5B2gM=
github.com/gofiber/utils v1.1.0 h1:vdEBpn7AzIUJRhe+CiTOJdUcTg4Q9RK+pEa0KPbLdrM=
github.com/gofiber/utils v1.1.0/go.mod h1:poZpsnhBykfnY1Mc0KeEa6mSHrS3dV0+oBWyeQmb2e0=
github.com/gogo/googleapis v1.1.0/go.mod h1:gf4bu3Q80BeJ6H1S1vYPm8/ELATdvryBaNFGgqEef3s=
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
github.com/golang/glog v0.0.0-20210429001901-424d2337a529/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
Expand Down
5 changes: 4 additions & 1 deletion api/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,10 @@ func main() {
store, err := frs.New(
frs.Config{URL: cfg.Cache.URL, Prefix: cfg.RateLimit.Prefix})
if err != nil {
rootLogger.Error("failed to initialize rate limiter",
zap.String("url", cfg.Cache.URL),
zap.String("prefix", cfg.RateLimit.Prefix),
zap.Error(err))
panic(err)
}

Expand All @@ -188,7 +192,6 @@ func main() {
Next: func(c *fiber.Ctx) bool {

ip := utils.GetRealIp(c)
rootLogger.Info("rate limit", zap.String("ip", ip))
return utils.IsPrivateIPAsString(ip)
},
Max: cfg.RateLimit.Max,
Expand Down

0 comments on commit 2c476dd

Please sign in to comment.