Version 0.2.0

Changes:
- forbid to overwrite secrets of other users
- add some logs of success
- add validation on code (length 50)
- use same limiter for POST requests
This commit is contained in:
2026-08-17 21:13:15 +00:03
parent 6ee80f1c8f
commit 094112af97
17 changed files with 185 additions and 38 deletions

View File

@@ -30,6 +30,7 @@ func New(
limiter *ratelimit.Limiter,
m metrics.Metrics,
trustedProxies []string,
logger *zap.Logger,
) (*gin.Engine, error) {
router := gin.New()
// Strict-server handlers only see context.Context (via *gin.Context, which
@@ -54,13 +55,13 @@ func New(
wrapper := api.ServerInterfaceWrapper{Handler: strictHandler}
router.POST("/api/v1/getValue",
api.InstrumentMiddleware("getValue", m.HTTP),
api.InstrumentMiddleware("getValue", m.HTTP, logger),
api.RateLimitMiddleware(limiter, m.Value),
wrapper.GetValue,
)
router.POST("/api/v1/setValue",
api.InstrumentMiddleware("setValue", m.HTTP),
api.BasicAuthMiddleware(users, m.Value),
api.InstrumentMiddleware("setValue", m.HTTP, logger),
api.BasicAuthMiddleware(users, limiter, m.Value),
wrapper.SetValue,
)