From e606af4eae78c8ed7fda98771bccbf1d49d6ff93 Mon Sep 17 00:00:00 2001 From: Henrique Dias Date: Mon, 22 Aug 2016 11:40:21 +0100 Subject: [PATCH] close #21 - still a bit unstable and not revised --- config/config.go | 40 ++++++++++++++++++++++++++++------------ 1 file changed, 28 insertions(+), 12 deletions(-) diff --git a/config/config.go b/config/config.go index 1706f6c1..66f68c92 100644 --- a/config/config.go +++ b/config/config.go @@ -153,12 +153,20 @@ func Parse(c *caddy.Controller) ([]Config, error) { return configs, c.ArgErr() } - cCfg.Rules = append(cCfg.Rules, &Rule{ - Regex: false, - Allow: true, - Path: c.Val(), - Regexp: nil, - }) + if c.Val() == "dotfiles" { + cCfg.Rules = append(cCfg.Rules, &Rule{ + Regex: true, + Allow: true, + Regexp: regexp.MustCompile("\\/\\..+"), + }) + } else { + cCfg.Rules = append(cCfg.Rules, &Rule{ + Regex: false, + Allow: true, + Path: c.Val(), + Regexp: nil, + }) + } case "allow_r": if !c.NextArg() { return configs, c.ArgErr() @@ -175,12 +183,20 @@ func Parse(c *caddy.Controller) ([]Config, error) { return configs, c.ArgErr() } - cCfg.Rules = append(cCfg.Rules, &Rule{ - Regex: false, - Allow: false, - Path: c.Val(), - Regexp: nil, - }) + if c.Val() == "dotfiles" { + cCfg.Rules = append(cCfg.Rules, &Rule{ + Regex: true, + Allow: false, + Regexp: regexp.MustCompile("\\/\\..+"), + }) + } else { + cCfg.Rules = append(cCfg.Rules, &Rule{ + Regex: false, + Allow: false, + Path: c.Val(), + Regexp: nil, + }) + } case "block_r": if !c.NextArg() { return configs, c.ArgErr()