Move Hardcoded Values to Config File
Labels: good first issue, enhancement
Description
Currently, configuration values like PORT, MAX_TIMEOUT_MS, POLL_MS, etc. are hardcoded in server.js and adapter.js. This task is to move them to a config file that can be customized without editing code.
What You'll Learn
- How to structure configuration in Node.js projects
- Environment variable handling
- Backward compatibility considerations
Requirements
-
Create a config.js (or .env + dotenv) that exports:
module.exports = {
PORT: process.env.PORT || 3000,
MAX_TIMEOUT_MS: parseInt(process.env.MAX_TIMEOUT_MS) || 180000,
STABLE_INTERVAL_MS: parseInt(process.env.STABLE_INTERVAL_MS) || 30000,
POLL_MS: parseInt(process.env.POLL_MS) || 500,
SESSION_TIMEOUT_MS: parseInt(process.env.SESSION_TIMEOUT_MS) || 3600000,
LARGE_PROMPT_THRESHOLD: parseInt(process.env.LARGE_PROMPT_THRESHOLD) || 15000
};
-
Update server.js to import and use these values
-
Update adapter.js to import and use these values
-
Add a .env.example file with documentation
-
Update README.md with a "Configuration" section
Files to Create/Modify
config.js (new)
.env.example (new)
server.js (update to use config)
adapter.js (update to use config)
README.md (add Configuration section)
.gitignore (add .env if not already present)
Testing
# Test with default values
npm run dev
# Test with custom port
PORT=4000 npm run dev
Reference
See CLAUDE.md "Configuration values" section for all values to extract.
Move Hardcoded Values to Config File
Labels:
good first issue,enhancementDescription
Currently, configuration values like
PORT,MAX_TIMEOUT_MS,POLL_MS, etc. are hardcoded inserver.jsandadapter.js. This task is to move them to a config file that can be customized without editing code.What You'll Learn
Requirements
Create a
config.js(or.env+ dotenv) that exports:Update
server.jsto import and use these valuesUpdate
adapter.jsto import and use these valuesAdd a
.env.examplefile with documentationUpdate README.md with a "Configuration" section
Files to Create/Modify
config.js(new).env.example(new)server.js(update to use config)adapter.js(update to use config)README.md(add Configuration section).gitignore(add.envif not already present)Testing
Reference
See CLAUDE.md "Configuration values" section for all values to extract.