Release v1.25.0
Release v1.25.0
✨ Features
BadgerDB Tracing
- Added context support and tracing for BadgerDB datasource operations, enhancing observability and tracking within the BadgerDB storage layer.(Released pkg/gofr/datasource/kv-store/badger - v0.2.0)
Redis Authentication Support
-
Users can now connect to Redis instances requiring a username, password, or both. Configure these credentials in the
.env
file located in theconfigs
folder:-
REDIS_USER
: User credential for connecting to the Redis server. Multiple users with different permissions can be configured within a single Redis instance. For more details, refer to the official Redis documentation. -
REDIS_PASSWORD
: Password credential required only if authentication is enabled on the Redis instance.
-
Enhanced Authentication Retrieval in Context
-
The
GetAuthInfo
method on the context provides easy access to various authentication methods, allowing developers to retrieve:-
JWT Claims: Use
GetAuthInfo().GetClaims()
when OAuth is enabled, returning ajwt.MapClaims
response. -
Username: Use
GetAuthInfo().GetUsername()
for basic authentication, returning the username or an empty string if basic auth is not enabled. -
API Key: Use
GetAuthInfo().GetAPIKey()
for API key-based authentication, returning the API key or an empty string if API key auth is not enabled.
-
🛠️ Fixes
Static File Route Issue
-
Resolved a bug in the
AddStaticFiles
method where static files could not be accessed via specified routes. Now, running the following code:func main() { app := gofr.New() app.AddStaticFiles("/", "./static") app.Run() }
Files within the
./static
directory can be accessed properly, e.g.,http://localhost:9000/abc.jpeg
, without encountering a "route not registered" error.
Controlled Access to OpenAPI Files
- Prevented direct access to the
openapi.json
file via static routes. The file is now restricted to access through explicitly defined routes such as/.well-known/swagger
or/.well-known/openapi.json
for secure and controlled API documentation access.