Comments (2)
The JS VM context that the workers run in does not expose process.env
and instead the toml vars are exposed as global strings:
From the docs:
Once a [...] variable [...] via wrangler [...], the string is exposed on the global namespace as type String.
Based on your example:
toml:
vars = { MAX_BOT_SCORE = "1" }
script:
if (MAX_BOT_SCORE === "1") {
// something
} else {
// something else
}
from cloudflare-worker-local.
Yes, that's right, this package intentionally does not support exporting process. If cloud flare does support this at some point, I'll add support here.
As a side note, if you are using web pack to bundle your script, you can use web pack environment plugin to handle this.
from cloudflare-worker-local.
Related Issues (20)
- Script called two times HOT 1
- Example worker modifies a Response object HOT 2
- It seems setTimeout is not working HOT 2
- request entity too large error HOT 3
- 1.9.1 release HOT 2
- Set cf config values in request headers
- Support FetchEvent.passThroughOnException() HOT 1
- Response.redirect is not a function HOT 2
- Move all program arguments into worker.toml config file HOT 9
- Refactor request handling
- Google drive index script is not working HOT 4
- npm install -g cloudflare-worker-local error HOT 3
- MINIO_PORT env var doesn't work HOT 3
- Need support for byob in getReader() HOT 1
- Binary site assets not transferring correctly HOT 1
- does not support ES module worker HOT 1
- Not possible to set cf-ipcountry header, it is always DEV HOT 2
- Getting error while running google index script HOT 2
- Response body can be falsy, test throws error
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cloudflare-worker-local.