cfw
cfw copied to clipboard
feat: add dotenv
Allow dynamic import of environment variables through a .env
file.
Improves the quality of life when populating environment variables locally.
Example cfw.js
module.exports = {
name: 'worker',
profile: 'default',
entry: 'index.ts',
routes: process.env.WORKER_ROUTES.split(',').filter((route) => route),
globals: {
KV_STORE: `KV:${KV_STORE}`,
SOME_ENV_VAR: `ENV:${process.env.SOME_ENV_VAR}`,
SOME_SECRET: `SECRET:${process.env.SOME_SECRET}`,
},
};
Example .env
WORKER_ROUTES=https://a.com/*,b.com/*
KV_STORE=abcd1234abcd1234abcd1234abcd1234
SOME_ENV_VAR=somevalue
SOME_SECRET=shhhhhhh