Skip to content

Commit

Permalink
refactor: reuse envName
Browse files Browse the repository at this point in the history
  • Loading branch information
pi0 committed May 5, 2023
1 parent d812f1d commit 252fbe0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/drivers/vercel-kv.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ export default defineDriver<VercelKVOptions>((opts) => {
}
if (!opts.token) {
const envName = envPrefix + "REST_API_TOKEN";
if (envPrefix && process.env[envPrefix + "REST_API_TOKEN"]) {
opts.token = process.env[envPrefix + "REST_API_TOKEN"];
if (envPrefix && process.env[envName]) {
opts.token = process.env[envName];
} else {
throw new Error(
`[unstorage] [vercel-kv] missing required 'token' option or '${envName}' env.`
Expand Down

0 comments on commit 252fbe0

Please sign in to comment.