diff options
author | Steve Manuel <nilslice@gmail.com> | 2016-11-29 22:59:14 -0800 |
---|---|---|
committer | Steve Manuel <nilslice@gmail.com> | 2016-11-29 22:59:14 -0800 |
commit | 9cbb99d6114e2f5a86d8dcd0cdec582aeaf9cce1 (patch) | |
tree | 42397e8123e2f7234bcee9b610435d2c80a67d3b /system/db/config.go | |
parent | eb3c58a9ba085979ece793f565cf5baefc280ac5 (diff) |
changing check for cache invalidation to after values are decoded
Diffstat (limited to 'system/db/config.go')
-rw-r--r-- | system/db/config.go | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/system/db/config.go b/system/db/config.go index 356a2da..4957d52 100644 --- a/system/db/config.go +++ b/system/db/config.go @@ -6,7 +6,6 @@ import ( "encoding/json" "fmt" "net/url" - "strings" "time" "github.com/bosssauce/ponzu/system/admin/config" @@ -26,11 +25,6 @@ func SetConfig(data url.Values) error { err := store.Update(func(tx *bolt.Tx) error { b := tx.Bucket([]byte("_config")) - if strings.ToLower(data.Get("cache")) == "invalidate" { - data.Set("etag", NewEtag()) - data.Del("cache") - } - cfg := &config.Config{} dec := schema.NewDecoder() dec.SetAliasTag("json") // allows simpler struct tagging when creating a content type @@ -40,6 +34,11 @@ func SetConfig(data url.Values) error { return err } + // check for "invalidate" value to reset the Etag + if len(cfg.CacheInvalidate) > 0 && cfg.CacheInvalidate[0] == "invalidate" { + cfg.Etag = NewEtag() + } + j, err := json.Marshal(cfg) if err != nil { return err |