close #21 - still a bit unstable and not revised

This commit is contained in:
Henrique Dias 2016-08-22 11:40:21 +01:00
parent a74393619f
commit e606af4eae

View File

@ -153,12 +153,20 @@ func Parse(c *caddy.Controller) ([]Config, error) {
return configs, c.ArgErr() return configs, c.ArgErr()
} }
cCfg.Rules = append(cCfg.Rules, &Rule{ if c.Val() == "dotfiles" {
Regex: false, cCfg.Rules = append(cCfg.Rules, &Rule{
Allow: true, Regex: true,
Path: c.Val(), Allow: true,
Regexp: nil, Regexp: regexp.MustCompile("\\/\\..+"),
}) })
} else {
cCfg.Rules = append(cCfg.Rules, &Rule{
Regex: false,
Allow: true,
Path: c.Val(),
Regexp: nil,
})
}
case "allow_r": case "allow_r":
if !c.NextArg() { if !c.NextArg() {
return configs, c.ArgErr() return configs, c.ArgErr()
@ -175,12 +183,20 @@ func Parse(c *caddy.Controller) ([]Config, error) {
return configs, c.ArgErr() return configs, c.ArgErr()
} }
cCfg.Rules = append(cCfg.Rules, &Rule{ if c.Val() == "dotfiles" {
Regex: false, cCfg.Rules = append(cCfg.Rules, &Rule{
Allow: false, Regex: true,
Path: c.Val(), Allow: false,
Regexp: nil, Regexp: regexp.MustCompile("\\/\\..+"),
}) })
} else {
cCfg.Rules = append(cCfg.Rules, &Rule{
Regex: false,
Allow: false,
Path: c.Val(),
Regexp: nil,
})
}
case "block_r": case "block_r":
if !c.NextArg() { if !c.NextArg() {
return configs, c.ArgErr() return configs, c.ArgErr()