Skip to content

Commit

Permalink
spread env into process.env
Browse files Browse the repository at this point in the history
in the _worker.js template take the provided env and
spread its values into the global process.env so that
bindings can be accessed in the Next.js application
  • Loading branch information
dario-piotrowicz committed Jan 24, 2023
1 parent c024bc7 commit 8de2e44
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions templates/_worker.js/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,8 @@ declare const __MIDDLEWARE__: EdgeFunctions;

export default {
async fetch(request, env, context) {
globalThis.process.env = { ...globalThis.process.env, ...env };

const { pathname } = new URL(request.url);
const routes = routesMatcher({ request }, __CONFIG__.routes);

Expand Down

0 comments on commit 8de2e44

Please sign in to comment.