feat: env-configurable runtime + modernized README + Apache 2.0 LICENSE#34
Merged
Merged
Conversation
added 2 commits
May 15, 2026 06:11
…upe pg-hstore Closes #27, closes #28. This is a one-time cleanup. No runtime behavior changes. - Add a standard Node .gitignore (node_modules/, *.log, .env, dist/, coverage/, editor noise). The repo previously had no .gitignore at all, which is how the 5176-file node_modules tree and the 197 KB npm-debug.log ended up tracked. - git rm -r --cached node_modules + git rm --cached npm-debug.log to stop tracking the already-committed files. Files stay on disk; only git's index is updated. Fresh clones recreate them via npm install. - package.json: remove the duplicate "pg-hstore" key. The file previously listed pg-hstore twice (^2.3.4 and ^2.3.3). JSON parsers keep the last entry, so the effective pin was the lower ^2.3.3. Kept ^2.3.4. - package.json: fix `main` to point at the actual entry point (server.js, not the nonexistent index.js). Drive-by because it's in the same file and the same shape of bug.
…e 2.0 Closes #29, closes #32. ## Runtime configuration (#29) server.js previously hardcoded: - listen port 80 (required root or setcap) - CORS origin http://localhost:4200 (unusable in any real deploy) app/config/env.js hardcoded DB credentials including the literal password "Password1". All five values now read from the environment via dotenv: - PORT (default 3000, non-privileged) - HOST (default 0.0.0.0 for container friendliness) - CORS_ORIGIN (default unset → cross-origin disabled; supports comma-separated list of allowed origins) - DB_HOST / DB_PORT / DB_NAME / DB_USER / DB_PASSWORD env.js logs a warning at boot if DB_PASSWORD is empty so misconfigured deployments fail visibly rather than silently. .env.example documents the full variable set. ## npm start (#32) Added "start": "node server.js" to package.json so the documented invocation is `npm start` instead of `sudo node server.js`. ## README modernization (#32) - Dropped Ubuntu 20.04 reference (EOL April 2025); requirements now list "Node.js 18+, PostgreSQL 14+, any currently supported Linux". - Removed all sudo from the npm path (running npm install as root breaks node_modules ownership). - Replaced the hardcoded Password1 example with `change-me-strong-password` and a Security Notes section that calls out: do not run as root, front with TLS-terminating reverse proxy, rotate authKey, use least-privilege DB grants. - Documented every env var in a table. ## Apache 2.0 relicense The repo previously had no LICENSE file at all — package.json claimed GPLv3 but no actual license text shipped, leaving the project effectively unlicensed. This commit: - Adds the full Apache License 2.0 text with "Copyright 2026 Aaron K. Clark" in the appendix. - Updates package.json to "license": "Apache-2.0" (SPDX identifier). - Updates README's License section. - Adds SPDX-License-Identifier headers to server.js, env.js, and db.config.js. Switching from "GPLv3 (claimed but unsourced)" to "Apache 2.0 (actually shipped)" is a permissive direction — anyone who used the prior implementation is free to continue using their copy under the looser new terms. ## New dependency - dotenv ^17.4.2 ## Acceptance criteria For #29: - [x] PORT=3000 npm start works for a non-root user. - [x] CORS_ORIGIN=https://example.com restricts CORS to that origin. - [x] README has an Environment Variables table. - [x] .env.example shipped. For #32: - [x] No sudo anywhere in the recommended quickstart. - [x] No literal credentials in the README. - [x] Setup steps work on Ubuntu 24.04 + Node 20+. - [x] Env vars documented: PORT, CORS_ORIGIN, DB_*. - [x] .env.example present with safe placeholders.
This was referenced May 15, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #29, closes #32.
Stacked on top of #33 (repo hygiene). Merge #33 first or this will be a slightly
noisier diff against
master.Summary
Three coordinated changes that move the project from "demo-shaped" to "deployable":
sudo, drops the literalPassword1example, documents every env var, adds a Security Notes section.package.jsonclaimedGPLv3but no license text existed). Now: full Apache 2.0 text, real copyright line, SPDX headers on touched source files.Runtime configuration
PORT3000(non-privileged)80(root required)HOST0.0.0.0CORS_ORIGINhttp://localhost:4200DB_HOST/DB_PORT/DB_NAME/DB_USER/DB_PASSWORDPassword1in sourceenv.jswarns at boot ifDB_PASSWORDis empty so misconfigured deploys fail visibly rather than silently..env.exampledocuments the full variable set.npm start
package.jsongains"start": "node server.js"so the documented invocation isnpm start, notsudo node server.js.README highlights
sudo, real.envflow,npm start.authKey; least-privilege DB grants.Apache 2.0 relicense
Copyright 2026 Aaron K. Clark.package.json:"license": "Apache-2.0"(SPDX identifier).server.js,app/config/env.js,app/config/db.config.js.Switching from "claimed-but-unsourced GPLv3" to "actually-shipped Apache 2.0" is the permissive direction — no existing user of the codebase loses any right.
New dependency
dotenv^17.4.2 (only addition).Verified locally
node --checkpasses onserver.js,env.js,db.config.js.dotenvloads.env.examplecorrectly and surfaces all expected variables.Proudly Made in Nebraska. Go Big Red! 🌽 https://xkcd.com/2347/