Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add dotenv #13

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

feat: add dotenv #13

wants to merge 1 commit into from

Conversation

licitdev
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant