diff --git a/.env.example b/.env.example index eb82beb..79c0887 100644 --- a/.env.example +++ b/.env.example @@ -23,7 +23,7 @@ COOKIE_SECURE=auto SESSION_MAX_AGE_HOURS=24 # SQLite DB path (sessions). Corrupt DB is rotated aside automatically. DB_PATH=./data/oscar-web.sqlite -# Web API devId/key - see planning.md open question 2 / M0. -DEV_ID=your-web-api-key # Long random string for cookie signing. SESSION_SECRET=change-me-to-a-long-random-string +# Set to production behind HTTPS reverse proxy. +NODE_ENV=development diff --git a/README.md b/README.md index 75d8953..d1f0bc0 100644 --- a/README.md +++ b/README.md @@ -65,8 +65,8 @@ Copy `.env.example` to `.env` and set values for your environment. | `COOKIE_SECURE` | Session cookie secure mode: `auto`, `true`, `false` | `auto` | | `SESSION_MAX_AGE_HOURS` | Session lifetime in hours | `24` | | `DB_PATH` | SQLite DB path for sessions | `./data/oscar-web.sqlite` | -| `DEV_ID` | Optional Web API devId/key if your server requires it | unset | | `SESSION_SECRET` | Long random secret for cookie signing | required | +| `NODE_ENV` | Runtime mode (`production` recommended behind HTTPS proxy) | `development` | ## Deployment (public / reverse proxy) @@ -82,6 +82,7 @@ PORT=3000 TRUST_PROXY=1 COOKIE_SECURE=true SESSION_SECRET=replace-with-a-long-random-secret +NODE_ENV=production ``` Protect `.env`: @@ -116,12 +117,12 @@ location /api/events { } ``` -For all other routes, proxy normally to `http://127.0.0.1:3000`. +For all other routes, proxy normally to `http://127.0.0.1:3000`. See `deploy/nginx.conf.example` for a full example. ### 3. Firewall / process - Do **not** expose port `3000` publicly; bind to `127.0.0.1`. -- Run with a process manager (e.g. systemd) and restart on failure. +- Run with a process manager (e.g. systemd) and restart on failure. See `deploy/oscar-web.service.example`. - Sessions are stored in SQLite; corrupted DB files are rotated aside and recreated automatically. Run as a single process. ## Security notes