Fix nil dereference in cloudflare store (#1504)

This commit is contained in:
Jake Sanders 2020-04-08 13:00:30 +01:00 committed by GitHub
parent 8400aba81c
commit 77f5cc5023
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -112,6 +112,9 @@ func (w *workersKV) Init(opts ...store.Option) error {
if len(w.options.Database) > 0 {
w.namespace = w.options.Database
}
if w.options.Context == nil {
w.options.Context = context.TODO()
}
ttl := w.options.Context.Value("STORE_CACHE_TTL")
if ttl != nil {
ttlduration, ok := ttl.(time.Duration)