Skip to content

fix(cli): honor STELLAR_CONFIG_HOME and STELLAR_HOME in identity export/import - #303

Merged
Dione-b merged 2 commits into
Dione-b:mainfrom
VeronicDev:fix/identity-stellar-home-233
Oct 20, 2026
Merged

Dione-b merged 2 commits into
Dione-b:mainfrom
VeronicDev:fix/identity-stellar-home-233

Conversation

@VeronicDev

Copy link
Copy Markdown
Contributor

Closes #233

Motivation
defaultStellarHome() always returned ~/.config/stellar despite help text claiming STELLAR_HOME support. With STELLAR_HOME=/secure/mainnet-keys, export shipped the wrong dir and import restored where stellar-cli won't look.

Behavior

  • defaultStellarHome() now respects STELLAR_CONFIG_HOME > STELLAR_HOME > XDG_CONFIG_HOME/stellar > ~/.config/stellar, matching stellar-cli resolution (--config-dir > STELLAR_CONFIG_HOME > XDG_CONFIG_HOME/stellar > default).
  • Empty/whitespace env values are ignored.
  • Exported function for testing; both export and import --path defaults use it.
  • Updated CLI help text and docs/cli.md.

Tests

  • Added 8 tests in identity.command.test.ts (defaultStellarHome env precedence (#233)): fallback, STELLAR_HOME, STELLAR_CONFIG_HOME, precedence, XDG, empty handling, and export-without---path e2e.
  • identity.command.test.ts: 14 passed
  • identity.ci-restore.test.ts: 3 passed
  • Full @caatinga/cli: 38 files, 252 tests passed, typecheck clean.

Release impact

  • Patch-level bugfix, no public API break (adds named export defaultStellarHome).
  • No version bump or lockfile change in this PR.

…rt/import

defaultStellarHome() now respects STELLAR_CONFIG_HOME > STELLAR_HOME >
XDG_CONFIG_HOME/stellar > ~/.config/stellar, matching stellar-cli
resolution. Fixes export shipping the wrong dir and import restoring
where stellar-cli won't look when STELLAR_HOME is set.
@drips-wave

drips-wave Bot commented Oct 16, 2026

Copy link
Copy Markdown

@VeronicDev Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

- Add a patch changeset for @caatinga/cli.
- Say which env vars stellar-cli reads instead of "matching stellar-cli".
- Show the env precedence in `identity import --help` and use `<dir>`
  in the docs headings.
- Remove the temporary STELLAR_HOME in a finally block in the test.
@Dione-b
Dione-b force-pushed the fix/identity-stellar-home-233 branch from 6e6df70 to 9dacac7 Compare October 20, 2026 17:20
@Dione-b
Dione-b merged commit 3dc12a7 into Dione-b:main Oct 20, 2026
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.

cli: identity export/import ignore STELLAR_HOME despite help text

2 participants