Skip to content

Indexer: CLI flags for the firehose switches (override env)#14

Merged
melvincarvalho merged 1 commit into
gh-pagesfrom
issue-13-indexer-cli
Jun 17, 2026
Merged

Indexer: CLI flags for the firehose switches (override env)#14
melvincarvalho merged 1 commit into
gh-pagesfrom
issue-13-indexer-cli

Conversation

@melvincarvalho

Copy link
Copy Markdown
Contributor

Closes #13. Adds CLI flags for the firehose switches so ad-hoc runs don't need inline env. Flags override env; env (pm2/.env) stays the fallback.

Flags

  • --hoses <list> / --hoses=<list> — comma list of hose names (overrides HOSES)
  • --no-legacy — disable the raw-upsert fallback (INDEX_LEGACY_KINDS=0)
  • --legacy — force it on
  • -h / --help — usage, then exit (no DB connection)
node index.js --hoses profiles --no-legacy

How

  • parseArgs(argv) → env-overlay with only the keys the user passed.
  • runIndexer merges { ...process.env, ...parseArgs() } and hands it to planIngest — flags win, env is the fallback, planIngest stays pure.
  • --help handled at both entry points (index.js, src/indexer.js).

Verification

  • npm test48/48 (new parseArgs tests: all flag forms + the flags-override-env merge contract).
  • node index.js --help prints usage without connecting to Mongo.
  • Live runs: --hoses profiles --no-legacyhoses: [profiles] legacy kinds: off subscribing kinds 0; and HOSES=follows … --hoses=profiles[profiles] (flag beat env).

Add --hoses / --legacy / --no-legacy / --help to the indexer, overriding
the matching env vars (env stays the fallback so pm2/.env keep working).

- src/indexer.js: parseArgs(argv) -> env-overlay; runIndexer merges it over
  process.env before planIngest (flags win). USAGE text; --help handled at
  the CLI entry points.
- index.js: honour --help before booting; note the override in a comment.
- README: document the flags in the Run section.
- test/indexer-args.test.js: parseArgs forms (--hoses, =value, bare, legacy
  on/off, help) + the flags-override-env merge contract.

npm test 48/48.

Closes #13
@melvincarvalho
melvincarvalho merged commit 887d3ed into gh-pages Jun 17, 2026
@melvincarvalho
melvincarvalho deleted the issue-13-indexer-cli branch June 17, 2026 09:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Indexer: CLI flags for the firehose switches (override env)

1 participant