TypeScript configuration pipeline replacing process-environment.sh
- Dominant language
- TypeScript
- Stars
- 481
- Forks
- 108
- Avg merge
- 6d 8h
- Merged PRs (30d)
- 5
Description
## Parent PRD
#1670
## What to build
Create a `startup-config.ts` module that replaces the environment variable reading and config merging logic from `process-environment.sh`. This module runs at server startup before the Express app is created.
The pipeline:
1. Load `.env` via dotenv (provides defaults like `LOG_LEVEL=info`)
2. Read `process.env` (Docker ENV vars override dotenv values)
3. If `config.json` exists at `CONFIGURATION_FOLDER_PATH`, parse it using the config.json parser (#1671) and overlay values onto the environment. Config.json wins over env vars for connection-related fields (preserving current shell script precedence).
4. If `NEPTUNE_NOTEBOOK` is truthy, force `PROXY_SERVER_HTTPS_CONNECTION=false`
5. Pass the resolved values to the existing `parseEnvironmentValues()` Zod pipeline
Key details:
- `GRAPH_EXP_HTTPS_CONNECTION` and `NEPTUNE_NOTEBOOK` are currently written to `.env` but never read by any TypeScript code — they are dead variables. Do not replicate this behavior.
- Only `PROXY_SERVER_HTTPS_CONNECTION` actually matters for the server from the values the shell script appends to `.env`.
- The shipped `.env` file stays unchanged. We stop appending to it.
Refer to the "Configuration Pipeline" and "Precedence Rules" sections of #1670 for details.
## Acceptance criteria
- [ ] Loads dotenv defaults, then process.env, then config.json overlay
- [ ] Config.json values override env vars for connection-related fields
- [ ] `NEPTUNE_NOTEBOOK=true` forces `PROXY_SERVER_HTTPS_CONNECTION=false`
- [ ] Does not write to `.env` or any other file
- [ ] Dead variables (`GRAPH_EXP_HTTPS_CONNECTION`, `NEPTUNE_NOTEBOOK` in `.env`) are not replicated
- [ ] Feeds resolved values to existing `parseEnvironmentValues()` Zod pipeline
- [ ] Unit tests cover: precedence rules, NEPTUNE_NOTEBOOK override, boolean case insensitivity, missing config.json, config.json with overrides
## Blocked by
- Blocked by #1671
## User stories addressed
- User story 1
- User story 4
- User story 8
- User story 9
Contributor guide
Assessment
This issue has not been assessed yet.