Skip to content

scripts/admin.ts declares a global --env-file option that register-importer never actually loads #1141

Description

@vjuliaife

Description:
scripts/admin.ts's top-level program declares .option("-e, --env-file <path>", "Path to .env file"), but the register-importer command (and the pool/contractClient/platformKeypair it imports from apps/api/src/db.js and stellar.js) are instantiated at module load time from whatever .env dotenv already picked up, before the option is even parsed. Passing --env-file has no effect, silently connecting to the default DB/network instead of the one requested.

Acceptance Criteria:

  • Either wire --env-file to actually load the given file before pool/contractClient/platformKeypair are constructed (e.g. via a preAction hook that calls dotenv.config before other imports resolve), or remove the flag and document that admin CLI always uses apps/api/.env
  • Add a startup log line printing which env file and DATABASE_URL host was used, so the wrong-environment mistake is visible immediately
  • Add a CLI test verifying --env-file changes which config is used
  • Update any docs referencing scripts/admin.ts --env-file usage

Relevant Files:

  • scripts/admin.ts — declares --env-file but pool/contractClient/platformKeypair are imported eagerly before it's parsed

Metadata

Metadata

Assignees

No one assigned

    Labels

    dxDeveloper experience / docs / namingtoolingAuto-created by repotool publish-folder

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions