Skip to content

Commit 786c86f

Browse files
fix: use DEVKIT_NODE_ env prefix instead of NODE_
NODE_ prefix collides with Node.js system env vars (NODE_OPTIONS, NODE_PATH, NODE_AUTH_TOKEN...) which get picked up by the config parser and corrupt the app config, causing ECONNREFUSED in CI. DEVKIT_NODE_ is specific enough to avoid collisions while matching the Devkit branding.
1 parent 1621977 commit 786c86f

6 files changed

Lines changed: 17 additions & 17 deletions

File tree

.claude/agents/stack-maintainer.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ You are the stack maintainer agent. Your role is to protect the mergeability and
1616
- **Secret leakage**: Check for accidentally committed secrets, tokens, or credentials
1717
- **Broad permissions**: Review permission changes for security risks
1818
- **Dependencies**: Flag suspicious or risky dependency additions
19-
- **Env vars**: Ensure sensitive config uses `NODE_*` env vars , not hardcoded values
19+
- **Env vars**: Ensure sensitive config uses `DEVKIT_NODE_*` env vars , not hardcoded values
2020
- **Auth bypass**: Watch for changes that weaken JWT/Passport validation or policy middleware
2121

2222
### 3. Verify modularity

.claude/skills/feature/SKILL.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,6 @@ npm test
7272

7373
## Notes
7474

75-
- Config is loaded from `config/` and overridable via `NODE_*` env vars
75+
- Config is loaded from `config/` and overridable via `DEVKIT_NODE_*` env vars
7676
- Authentication is handled via Passport JWT middleware — don't reimplement
7777
- All policies must use `lib/middlewares/policy.js` patterns

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ Runs the server at `http://localhost:3000/`. For auto-reload during development,
6767
**CORS Note:** When connecting to the Vue stack, ensure CORS is configured:
6868

6969
```bash
70-
NODE_cors_origin=['http://localhost:8080'] npm start
70+
DEVKIT_NODE_cors_origin=['http://localhost:8080'] npm start
7171
```
7272

7373
### Production
@@ -113,17 +113,17 @@ GITHUB_TOKEN=xxx npm run release:auto # Semantic release (CI)
113113

114114
Configuration files live in `config/defaults/`. The `development.js` file is the base; other files in that folder override it.
115115

116-
Environment variables prefixed with `NODE_` are merged on top . The variable path maps directly to the config object key:
116+
Environment variables prefixed with `DEVKIT_NODE_` are merged on top . The variable path maps directly to the config object key:
117117

118118
```bash
119-
NODE_app_title='my app' # sets config.app.title
120-
NODE_db_uri='mongodb://...' # sets config.db.uri
119+
DEVKIT_NODE_app_title='my app' # sets config.app.title
120+
DEVKIT_NODE_db_uri='mongodb://...' # sets config.db.uri
121121
```
122122

123123
## :whale: Docker
124124

125125
```bash
126-
docker run --env NODE_db_uri=mongodb://host.docker.internal/NodeDev --env NODE_host=0.0.0.0 --rm -p 3000:3000 pierreb/node
126+
docker run --env DEVKIT_NODE_db_uri=mongodb://host.docker.internal/NodeDev --env DEVKIT_NODE_host=0.0.0.0 --rm -p 3000:3000 pierreb/node
127127
```
128128

129129
Build yourself:

config/defaults/development.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ const config = {
33
title: 'Devkit Node - Development Environment',
44
description: 'Node - Boilerplate Back : Express, Jwt, Mongo, Sequelize (Beta) ',
55
keywords: 'node, express, mongo, jwt, sequelize, stack, boilerplate',
6-
googleAnalyticsTrackingID: 'NODE_app_googleAnalyticsTrackingID',
6+
googleAnalyticsTrackingID: 'DEVKIT_NODE_app_googleAnalyticsTrackingID',
77
contact: 'contact@example.com',
88
},
99
swagger: {
@@ -165,12 +165,12 @@ const config = {
165165
expiresIn: 7 * 24 * 60 * 60, // token expire in x sec
166166
},
167167
mailer: {
168-
from: 'NODE_mailer_from',
168+
from: 'DEVKIT_NODE_mailer_from',
169169
options: {
170-
service: 'NODE_mailer_options_service',
170+
service: 'DEVKIT_NODE_mailer_options_service',
171171
auth: {
172-
user: 'NODE_mailer_options_auth_user',
173-
pass: 'NODE_mailer_options_auth_pass',
172+
user: 'DEVKIT_NODE_mailer_options_auth_user',
173+
pass: 'DEVKIT_NODE_mailer_options_auth_pass',
174174
},
175175
},
176176
},

config/index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@ const initGlobalConfig = async () => {
2121
console.error(chalk.red(`+ Error: No configuration file found for "${process.env.NODE_ENV}" environment using development instead. (${_path})`));
2222
defaultConfig = await import(path.join(process.cwd(), './config', 'defaults', 'development.js'));
2323
}
24-
// Get the config from process.env.NODE_*
24+
// Get the config from process.env.DEVKIT_NODE_*
2525
let environmentVars = _.mapKeys(
26-
_.pickBy(process.env, (_value, key) => key.startsWith('NODE_') && key !== 'NODE_ENV'),
27-
(_v, k) => k.split('_').slice(1).join('.'),
26+
_.pickBy(process.env, (_value, key) => key.startsWith('DEVKIT_NODE_')),
27+
(_v, k) => k.split('_').slice(2).join('.'),
2828
);
2929
// convert string array from sys to real array
3030
environmentVars = _.mapValues(environmentVars, (v) => (v[0] === '[' && v[v.length - 1] === ']' ? v.replace(/'/g, '').slice(1, -1).split(',') : v));

docker-compose.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ services:
1414
depends_on:
1515
- mongo
1616
environment:
17-
- 'NODE_db_uri=mongodb://mongo:27017/NodeDev'
18-
- 'NODE_host=0.0.0.0'
17+
- 'DEVKIT_NODE_db_uri=mongodb://mongo:27017/NodeDev'
18+
- 'DEVKIT_NODE_host=0.0.0.0'
1919

2020
mongo:
2121
container_name: mongo

0 commit comments

Comments
 (0)