allow token update
This commit is contained in:
parent
3081058efb
commit
5b0989fbc3
12
main.go
12
main.go
@ -10,6 +10,7 @@ import (
|
|||||||
var HOST string
|
var HOST string
|
||||||
var PORT string
|
var PORT string
|
||||||
var PUID string
|
var PUID string
|
||||||
|
var ACCESS_TOKENS []string
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
HOST = os.Getenv("SERVER_HOST")
|
HOST = os.Getenv("SERVER_HOST")
|
||||||
@ -53,5 +54,16 @@ func main() {
|
|||||||
}
|
}
|
||||||
c.String(200, "password updated")
|
c.String(200, "password updated")
|
||||||
})
|
})
|
||||||
|
router.PATCH("/admin/tokens", admin_check, func(c *gin.Context) {
|
||||||
|
// Get the tokens from the request (json) and update the tokens
|
||||||
|
var tokens []string
|
||||||
|
err := c.BindJSON(&tokens)
|
||||||
|
if err != nil {
|
||||||
|
c.String(400, "tokens not provided")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
ACCESS_TOKENS = tokens
|
||||||
|
c.String(200, "tokens updated")
|
||||||
|
})
|
||||||
router.Run(HOST + ":" + PORT)
|
router.Run(HOST + ":" + PORT)
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user