support ability to set store, address and namespace via flags and env vars (#1092)

This commit is contained in:
Asim Aslam
2020-01-08 12:11:31 +00:00
committed by GitHub
parent 0b8ff3a8bb
commit 048065fe96
9 changed files with 143 additions and 50 deletions

View File

@@ -25,10 +25,6 @@ func getAccount(ctx context.Context) string {
return getOption(ctx, "CF_ACCOUNT_ID")
}
func getNamespace(ctx context.Context) string {
return getOption(ctx, "KV_NAMESPACE_ID")
}
// Token sets the cloudflare api token
func Token(t string) store.Option {
return func(o *store.Options) {
@@ -52,9 +48,6 @@ func Account(id string) store.Option {
// Namespace sets the KV namespace
func Namespace(ns string) store.Option {
return func(o *store.Options) {
if o.Context == nil {
o.Context = context.Background()
}
o.Context = context.WithValue(o.Context, "KV_NAMESPACE_ID", ns)
o.Namespace = ns
}
}