Skip to content

Commit 4757eda

Browse files
Replace DENO_KV_PATH with DKV_PATH
Thought process: <#328 (comment)>
1 parent cffb13c commit 4757eda

2 files changed

Lines changed: 5 additions & 8 deletions

File tree

deno.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"check:license": "deno run -A tools/check_license.ts",
1717
"check:docs": "deno doc --lint mod.ts",
1818
"check": "deno task check:license --check",
19-
"test": "DENO_KV_PATH=:memory: deno test --unstable-kv --allow-env --allow-read --allow-run --parallel --trace-leaks --coverage --doc",
19+
"test": "DKV_PATH =:memory: deno test --unstable-kv --allow-env --allow-read --allow-run --parallel --trace-leaks --coverage --doc",
2020
"coverage": "deno coverage coverage",
2121
"ok": "deno fmt --check && deno lint && deno task check && deno task test",
2222
"cov:gen": "deno task coverage --lcov --output=cov.lcov",

lib/_kv.ts

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
// Copyright 2023-2024 the Deno authors. All rights reserved. MIT license.
2-
const DENO_KV_PATH_KEY = "DENO_KV_PATH";
2+
const DKV_PATH_KEY = "DKV_PATH";
33
let path = undefined;
44
if (
5-
(await Deno.permissions.query({ name: "env", variable: DENO_KV_PATH_KEY }))
5+
(await Deno.permissions.query({ name: "env", variable: DKV_PATH_KEY }))
66
.state === "granted"
77
) {
8-
path = Deno.env.get(DENO_KV_PATH_KEY);
8+
path = Deno.env.get(DKV_PATH_KEY);
99
}
1010
const kv = await Deno.openKv(path);
1111

@@ -34,10 +34,7 @@ export async function getAndDeleteOAuthSession(
3434
throw new Deno.errors.NotFound("OAuth session not found");
3535
}
3636

37-
const res = await kv.atomic()
38-
.check(oauthSessionRes)
39-
.delete(key)
40-
.commit();
37+
const res = await kv.atomic().check(oauthSessionRes).delete(key).commit();
4138

4239
if (!res.ok) throw new Error("Failed to delete OAuth session");
4340
return oauthSession;

0 commit comments

Comments
 (0)