diff options
-rw-r--r-- | system/admin/config/config.go | 6 | ||||
-rw-r--r-- | system/db/config.go | 4 |
2 files changed, 6 insertions, 4 deletions
diff --git a/system/admin/config/config.go b/system/admin/config/config.go index ba8ffb3..3d36a14 100644 --- a/system/admin/config/config.go +++ b/system/admin/config/config.go @@ -15,7 +15,7 @@ type Config struct { AdminEmail string `json:"admin_email"` ClientSecret string `json:"client_secret"` Etag string `json:"etag"` - CacheInvalidate []string `json:"-"` + CacheInvalidate []string `json:"cache"` } // ContentName partially implements editor.Editable @@ -67,10 +67,10 @@ func (c *Config) MarshalEditor() ([]byte, error) { }), }, editor.Field{ - View: editor.Checkbox("CacheInvalidate", c, map[string]string{ + View: editor.Checkbox("cacheInvalidate", c, map[string]string{ "label": "Invalidate cache on save", }, map[string]string{ - "cache": "invalidate", + "cache": "Invalidate", }), }, ) diff --git a/system/db/config.go b/system/db/config.go index bfcafc6..356a2da 100644 --- a/system/db/config.go +++ b/system/db/config.go @@ -6,6 +6,7 @@ import ( "encoding/json" "fmt" "net/url" + "strings" "time" "github.com/bosssauce/ponzu/system/admin/config" @@ -25,8 +26,9 @@ func SetConfig(data url.Values) error { err := store.Update(func(tx *bolt.Tx) error { b := tx.Bucket([]byte("_config")) - if data.Get("cache") == "invalidate" { + if strings.ToLower(data.Get("cache")) == "invalidate" { data.Set("etag", NewEtag()) + data.Del("cache") } cfg := &config.Config{} |