fix(db): remove authorization for battery status endpoint
This endpoint is now publicly available without the need of an authorization Signed-off-by: Klagarge <remi@heredero.ch>
This commit is contained in:
@@ -18,4 +18,3 @@ Authorization: Basic {{username}} {{password}}
|
|||||||
|
|
||||||
### GET battery status of all devices
|
### GET battery status of all devices
|
||||||
GET {{host}}/api/v1/battery
|
GET {{host}}/api/v1/battery
|
||||||
Authorization: Basic {{username}} {{password}}
|
|
||||||
|
|||||||
@@ -63,6 +63,10 @@ func (g *RestGateway) setupRoutes() {
|
|||||||
g.engine.Use(cors.New(corsConfig))
|
g.engine.Use(cors.New(corsConfig))
|
||||||
|
|
||||||
v1 := g.engine.Group("/api/v1")
|
v1 := g.engine.Group("/api/v1")
|
||||||
|
|
||||||
|
// Public endpoints (no auth required)
|
||||||
|
v1.GET("/battery", g.getBattery)
|
||||||
|
|
||||||
if g.username != "" && g.password != "" {
|
if g.username != "" && g.password != "" {
|
||||||
v1.Use(gin.BasicAuth(gin.Accounts{
|
v1.Use(gin.BasicAuth(gin.Accounts{
|
||||||
g.username: g.password,
|
g.username: g.password,
|
||||||
@@ -73,7 +77,6 @@ func (g *RestGateway) setupRoutes() {
|
|||||||
v1.GET("/rooms", g.getRooms)
|
v1.GET("/rooms", g.getRooms)
|
||||||
v1.GET("/rooms/:room-id/current", g.getRoomCurrent)
|
v1.GET("/rooms/:room-id/current", g.getRoomCurrent)
|
||||||
v1.GET("/rooms/:room-id/history", g.getRoomHistory)
|
v1.GET("/rooms/:room-id/history", g.getRoomHistory)
|
||||||
v1.GET("/battery", g.getBattery)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
g.engine.GET("/swagger/*any", ginSwagger.WrapHandler(swaggerFiles.Handler))
|
g.engine.GET("/swagger/*any", ginSwagger.WrapHandler(swaggerFiles.Handler))
|
||||||
|
|||||||
Reference in New Issue
Block a user