diff --git a/src/index.js b/src/index.js index e99c704..afa4594 100644 --- a/src/index.js +++ b/src/index.js @@ -535,6 +535,7 @@ export default { globalThis.LOGS_BUCKET = env.LOGS_BUCKET globalThis.REQUEST_ANALYTICS = env.REQUEST_ANALYTICS globalThis.API_TEST_USERAGENT = env.API_TEST_USERAGENT + globalThis.ENVIRONMENT = env.ENVIRONMENT const startTime = Date.now() const url = new URL(request.url) diff --git a/src/package.json b/src/package.json index eff251d..9630165 100644 --- a/src/package.json +++ b/src/package.json @@ -5,7 +5,10 @@ "main": "src/index.js", "scripts": { "test": "echo \"Error: no test specified\" && exit 1", - "publish": "wrangler publish" + "publish": "wrangler publish", + "deploy:staging": "wrangler deploy --env staging", + "deploy:production": "wrangler deploy --env production", + "tail:staging": "wrangler tail --env staging" }, "repository": { "type": "git", diff --git a/src/wrangler.toml b/src/wrangler.toml index be809da..d75ff25 100644 --- a/src/wrangler.toml +++ b/src/wrangler.toml @@ -40,6 +40,8 @@ bucket_name = "evergreen-api" binding = "REQUEST_ANALYTICS" dataset = "evergreen_requests" +# Staging: https://evergreen-api-staging.stealthpuppy.workers.dev +# Shares the production EVERGREEN KV namespace (read-only usage), but logs/analytics are kept separate [env.staging] name = "evergreen-api-staging" vars = { ENVIRONMENT = "staging" } diff --git a/tests/package.json b/tests/package.json index d385f04..844e66b 100644 --- a/tests/package.json +++ b/tests/package.json @@ -1,6 +1,7 @@ { "scripts": { - "test": "mocha" + "test": "mocha", + "test:staging": "API_BASE_URL=https://evergreen-api-staging.stealthpuppy.workers.dev mocha" }, "devDependencies": { "chai": "^6.2.2",