Skip to content

Commit

Permalink
refactor: Simplify environment variable initialization with defaults
Browse files Browse the repository at this point in the history
  • Loading branch information
tarasglek committed Jan 8, 2025
1 parent 6273e53 commit 2d5c55a
Showing 1 changed file with 7 additions and 13 deletions.
20 changes: 7 additions & 13 deletions deno/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,13 @@ import { asSerializablePattern } from "jsr:@http/discovery/as-serializable-patte
import { byPattern } from "jsr:@http/route/by-pattern";
import { handle } from "jsr:@http/route/handle";

const env = { ...Deno.env.toObject() };
if (!env.ENVIRONMENT) {
env.ENVIRONMENT = "development";
}
if (!env.CLIENT_ID) {
env.CLIENT_ID = "client_id";
}
if (!env.CLIENT_SECRET) {
env.CLIENT_SECRET = "client_secret";
}
if (!env.JWT_SECRET) {
env.JWT_SECRET = "jwt_secret";
}
const env = {
ENVIRONMENT: "development",
CLIENT_ID: "client_id",
CLIENT_SECRET: "client_secret",

Check failure on line 13 in deno/main.ts

View workflow job for this annotation

GitHub Actions / Lint

Delete `·`
JWT_SECRET: "jwt_secret",
...Deno.env.toObject()

Check failure on line 15 in deno/main.ts

View workflow job for this annotation

GitHub Actions / Lint

Insert `,`
};

// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
function adaptLegacyCloudflareHandler(handler: Function) {
Expand Down

0 comments on commit 2d5c55a

Please sign in to comment.