This commit is contained in:
Henrique Dias
2016-06-14 18:19:10 +01:00
parent 8393244e9d
commit e137f46169
7 changed files with 157 additions and 64 deletions

View File

@@ -4,6 +4,7 @@ import (
"fmt"
"io/ioutil"
"net/http"
"strings"
"github.com/mholt/caddy"
"github.com/mholt/caddy/caddyhttp/httpserver"
@@ -54,7 +55,7 @@ func parseConfiguration(c *caddy.Controller) ([]Config, error) {
}
for c.Next() {
var cfg = Config{PathScope: "."}
var cfg = Config{PathScope: ".", BaseURL: ""}
for c.NextBlock() {
switch c.Val() {
case "show":
@@ -67,6 +68,9 @@ func parseConfiguration(c *caddy.Controller) ([]Config, error) {
return configs, c.ArgErr()
}
cfg.BaseURL = c.Val()
cfg.BaseURL = strings.TrimPrefix(cfg.BaseURL, "/")
cfg.BaseURL = strings.TrimSuffix(cfg.BaseURL, "/")
cfg.BaseURL = "/" + cfg.BaseURL
case "styles":
if !c.NextArg() {
return configs, c.ArgErr()