BugdrLog in
All problems
EasyJavaScriptBackend Engineer · cli · configuration · error-handling · nodejs · static-files

Command-line config file loading

★ 0.0 (0 ratings)30 min0 engineers solved this

Your assignment

This is a small Node.js command-line tool that serves a directory of static files over HTTP. The entry script in bin/ parses flags with the arg library (listen endpoints, single-page rewrite mode, debug output, a config file path, and so on). It then resolves the directory to serve and calls loadConfig, which reads settings from candidate JSON files in priority order: an explicitly given --config file first, then serve.json, then now.json and package.json as deprecated fallbacks. Each file is parsed, its sections are extracted, the merged result is validated against a JSON schema, and the final object is passed to the request handler library on every request. The script also prints informational and warning messages to the console and runs an optional update check that can be disabled with the NO_UPDATE_CHECK environment variable.

What the team is seeing

incident log
A team started their static site with a custom settings file that they pass on the command line, but the site behaves as if that file were never read. Nothing tells them anything is wrong, so the default settings quietly stay in effect in production.

Acceptance checks 1

  • Check 1

Discussion is locked — log in and complete this problem to join the discussion and rate your experience.