Skip to content

Commit 201b375

Browse files
committed
Edit default env variables and secrets
1 parent 700b15a commit 201b375

File tree

7 files changed

+11
-11
lines changed

7 files changed

+11
-11
lines changed

.dev.vars.example

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
INFLUX_TOKEN="example"

.env.example

Lines changed: 0 additions & 4 deletions
This file was deleted.

.github/workflows/ci.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ jobs:
3030
preCommands: |
3131
cp wranger.toml.example wrangler.toml
3232
echo "[env.production.vars]" >> wrangler.toml
33+
echo "ENVIRONMENT = 'production'" >> wrangler.toml"
3334
echo "INFLUX_URL = '${{ env.INFLUX_URL }}'" >> wrangler.toml
3435
echo "INFLUX_METRIC_NAME = '${{ env.INFLUX_METRIC_NAME }}'" >> wrangler.toml
3536
echo "INFLUX_DATABASE = '${{ env.INFLUX_DATABASE }}'" >> wrangler.toml

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ worker/
88
node_modules/
99
.cargo-ok
1010
.env
11+
.dev.vars
1112
.wrangler
1213
data/
1314
config/

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,21 +13,21 @@ npm install
1313
2. Copy example files
1414

1515
```
16-
cp .env.example .env
16+
cp .dev.vars.example .dev.vars
1717
cp wrangler.toml.example wrangler.toml
1818
```
1919

20-
3. Edit environment variables in `.env` and `wrangler.toml` files
20+
3. Edit secrets inside `.dev.vars` and environment variables inside `wrangler.toml` files
2121

2222
3. Run your worker
2323

2424
```
2525
npm run dev
2626
```
2727

28-
## Deployment
28+
## Deployment to production
2929

30-
In order to deploy your worker, you need to have a [Cloudflare API token](https://developers.cloudflare.com/fundamentals/api/get-started/create-token/) and running instance of InfluDB.
30+
In order to deploy your worker via Github Actions, you need to have a [Cloudflare API token](https://developers.cloudflare.com/fundamentals/api/get-started/create-token/) and running instance of InfluxDB.
3131

3232
Add generated API token to Github secrets as `CLOUDFLARE_API_TOKEN` and authentication token under `INFLUX_TOKEN`.
3333

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
"main": "index.js",
77
"scripts": {
88
"deploy": "wrangler deploy",
9-
"dev": "wrangler dev",
9+
"deploy:prod": "wrangler deploy --env production",
10+
"dev": "wrangler dev --env dev",
1011
"start": "wrangler dev",
1112
"test": "vitest run",
1213
"test:watch": "vitest"

wrangler.toml.example

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ main = "bin/worker.js"
33
compatibility_date = "2024-12-05"
44
compatibility_flags = ["nodejs_compat"]
55

6-
[vars]
6+
[env.dev.vars]
7+
ENVIRONMENT = "dev"
78
INFLUX_METRIC_NAME = "example"
89
INFLUX_URL = "http://localhost:8086"
9-
INFLUX_TOKEN = "example"
1010
INFLUX_DATABASE = "example"

0 commit comments

Comments
 (0)