From 3838220530ac75c10f485c36e1bf19f721659920 Mon Sep 17 00:00:00 2001 From: felixvippp-ai Date: Wed, 24 Jun 2026 00:11:13 -0400 Subject: [PATCH] docs: document environment configuration --- .env.example | 13 +++++++++++++ .gitignore | 1 + README.md | 13 +++++++++++++ 3 files changed, 27 insertions(+) create mode 100644 .env.example diff --git a/.env.example b/.env.example new file mode 100644 index 0000000..588f017 --- /dev/null +++ b/.env.example @@ -0,0 +1,13 @@ +# AgentPay backend environment example. +# This file is safe to commit. Do not commit real .env files or secrets. + +# HTTP port used when the built server starts with `npm start`. +PORT=3001 + +# Comma-separated exact Origin allowlist for CORS reflection. +# Leave empty to avoid reflecting cross-origin browser requests. +CORS_ALLOWED_ORIGINS= + +# Node runtime mode. Use `production` for deployed runtimes. +# Tests set NODE_ENV=test to skip rate limiting and suppress duration logs. +NODE_ENV=development diff --git a/.gitignore b/.gitignore index ae41fb7..4e8d93e 100644 --- a/.gitignore +++ b/.gitignore @@ -2,5 +2,6 @@ node_modules dist .env .env.* +!.env.example *.log .DS_Store diff --git a/README.md b/README.md index fa721c7..bc225ae 100644 --- a/README.md +++ b/README.md @@ -39,6 +39,19 @@ API gateway, metering, and billing backend for the AgentPay protocol (machine-to ``` Server runs at `http://localhost:3001`. Try `GET /health` and `GET /api/v1/version`. +## Configuration + +The backend reads configuration from process environment variables. Provide +these through your shell, process manager, container runtime, or PaaS. The +checked-in `.env.example` is a safe reference template; real `.env` files remain +ignored by git. + +| Variable | Default | Effect | +| ---------------------- | ------- | ------ | +| `PORT` | `3001` | Port used by the HTTP server when the built app starts. | +| `CORS_ALLOWED_ORIGINS` | empty | Comma-separated exact Origin allowlist. Matching origins are reflected in `Access-Control-Allow-Origin`; an empty value does not reflect cross-origin browser requests. | +| `NODE_ENV` | unset | Set to `test` to skip the in-process rate limiter and suppress duration logs during tests. Use `production` for deployed runtimes. | + ## Project structure ```