NoAuth for Caddy plugins
Former-commit-id: 5b8306eb527c9f21d14736c97e67b8689e69d025 [formerly 42d1b7035277e06aecc9a812ea4d92022a36c2a6] [formerly 31905bebcc8f337bc8f6815425778bfc652f43e4 [formerly b5961b6b63
]]
Former-commit-id: 44aa1bc7df6ffa633b333b75a5045c612db44aae [formerly d22761bb6f49156f7889e28f3af8edb439c7e023]
Former-commit-id: 5a8a899a97bb7ec4c9433723c7d53f87163cccac
This commit is contained in:
parent
bda4fc16eb
commit
4f3375ee8d
|
@ -10,6 +10,7 @@ import (
|
|||
"net/http"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
. "github.com/hacdias/filemanager"
|
||||
|
@ -73,6 +74,7 @@ func parse(c *caddy.Controller) ([]*config, error) {
|
|||
baseURL := "/"
|
||||
baseScope := "."
|
||||
database := ""
|
||||
noAuth := false
|
||||
|
||||
// Get the baseURL and baseScope
|
||||
args := c.RemainingArgs()
|
||||
|
@ -93,6 +95,17 @@ func parse(c *caddy.Controller) ([]*config, error) {
|
|||
}
|
||||
|
||||
database = c.Val()
|
||||
case "no_auth":
|
||||
if !c.NextArg() {
|
||||
noAuth = true
|
||||
continue
|
||||
}
|
||||
|
||||
var err error
|
||||
noAuth, err = strconv.ParseBool(c.Val())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -143,6 +156,7 @@ func parse(c *caddy.Controller) ([]*config, error) {
|
|||
return nil, err
|
||||
}
|
||||
|
||||
fm.NoAuth = noAuth
|
||||
m := &config{FileManager: fm}
|
||||
m.SetBaseURL(baseURL)
|
||||
m.SetPrefixURL(strings.TrimSuffix(caddyConf.Addr.Path, "/"))
|
||||
|
|
|
@ -7,6 +7,7 @@ import (
|
|||
"net/http"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/hacdias/filemanager"
|
||||
|
@ -42,6 +43,7 @@ func parse(c *caddy.Controller) ([]*filemanager.FileManager, error) {
|
|||
directory := "."
|
||||
admin := "/admin"
|
||||
database := ""
|
||||
noAuth := false
|
||||
|
||||
// Get the baseURL and baseScope
|
||||
args := c.RemainingArgs()
|
||||
|
@ -62,6 +64,17 @@ func parse(c *caddy.Controller) ([]*filemanager.FileManager, error) {
|
|||
}
|
||||
|
||||
database = c.Val()
|
||||
case "no_auth":
|
||||
if !c.NextArg() {
|
||||
noAuth = true
|
||||
continue
|
||||
}
|
||||
|
||||
var err error
|
||||
noAuth, err = strconv.ParseBool(c.Val())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -132,6 +145,7 @@ func parse(c *caddy.Controller) ([]*filemanager.FileManager, error) {
|
|||
return nil, err
|
||||
}
|
||||
|
||||
m.NoAuth = noAuth
|
||||
m.SetBaseURL(admin)
|
||||
m.SetPrefixURL(strings.TrimSuffix(caddyConf.Addr.Path, "/"))
|
||||
configs = append(configs, m)
|
||||
|
|
Loading…
Reference in New Issue