dashboard: Can restrict access through htpasswd
This commit is contained in:
parent
635e67c224
commit
437ed4d393
5 changed files with 89 additions and 2 deletions
|
|
@ -15,7 +15,7 @@ type App struct {
|
|||
bind string
|
||||
}
|
||||
|
||||
func NewApp(baseURL string, bind string) App {
|
||||
func NewApp(htpasswd_file *string, baseURL string, bind string) App {
|
||||
gin.ForceConsoleColor()
|
||||
router := gin.Default()
|
||||
|
||||
|
|
@ -29,6 +29,11 @@ func NewApp(baseURL string, bind string) App {
|
|||
} else {
|
||||
baserouter = router.Group("")
|
||||
}
|
||||
|
||||
if htpasswd_file != nil && len(*htpasswd_file) > 0 {
|
||||
baserouter.Use(Htpassword(*htpasswd_file))
|
||||
}
|
||||
|
||||
declareStaticRoutes(baserouter, baseURL)
|
||||
|
||||
app := App{
|
||||
|
|
|
|||
Reference in a new issue