Skip to content

fix(config): read Stellar gateway settings from env and sync .env.example - #275

Merged
akargi merged 1 commit into
Chulilee:mainfrom
SungJiinwoo:fix/env-example-gateway-config
Oct 2, 2026
Merged

akargi merged 1 commit into
Chulilee:mainfrom
SungJiinwoo:fix/env-example-gateway-config

Conversation

@SungJiinwoo

Copy link
Copy Markdown
Contributor

Summary

The Stellar gateway services read stellar.poolMinConnections, stellar.rateLimitPerMinute, etc., but configuration.ts never defined those keys, so the STELLAR_* values in .env.example had no effect and the gateway always ran on its hard-coded defaults. This maps them, validates them, and brings .env.example in line with the schema.

Related Issues

Closes #67

Type of Change

  • Bug fix (non-breaking change that fixes an issue)

Changes

  • configuration.ts: read the ten gateway keys under stellar (same defaults the services already fall back to, so nothing changes for anyone who hasn't set them).
  • env.validation.ts: validate the gateway keys; add TELEGRAM_BOT_TOKEN and DISCORD_WEBHOOK_URL, which the notification providers read.
  • .env.example: list every key the schema declares; optional secrets are left commented out.
  • New specs: .env.example validates strictly against the schema, both sides list the same keys, and configuration.ts picks up the gateway values.

Checklist

  • I have read the CONTRIBUTING guide.
  • npm run lint passes.
  • npx tsc --noEmit passes (no type errors).
  • npm run build succeeds.
  • npm test passes, and I added/updated tests for my change where it made sense.
  • Any Stellar/Soroban network access goes through the stellar module services (no direct Horizon/RPC calls from feature modules).
  • I did not commit secrets, private keys, or mainnet credentials.

Notes for Reviewers

npm run lint and npm test already fail on main (677 lint errors, 11 failing unit tests in analytics, notifications and the request queue). I ran both on main and on this branch: the failures are the same, this PR adds none, ESLint is clean on src/config, and the 5 new tests pass.

On the boot error in the issue: as far as I can tell it doesn't actually happen. When validationOptions omits allowUnknown, @nestjs/config sets it to true (config.module.ts). Strict mode couldn't work at boot anyway, because the schema is validated against .env merged with the whole process.env (PATH and so on). So I made allowUnknown: true explicit with a comment and moved the strict check into a spec, which is what actually keeps the two files from drifting. That's a change from the plan in my comment on the issue.

…mple

The pool, rate limiter and request queue services look up
stellar.poolMinConnections, stellar.rateLimitPerMinute, etc., but
configuration.ts never defined those keys, so the STELLAR_* values in
.env.example had no effect and every gateway setting silently fell back
to its hard-coded default. Map them under `stellar` and validate them.

While here, bring .env.example in line with envValidationSchema: add the
keys it was missing (Soroban, indexer, rate limit, notifications) and
declare TELEGRAM_BOT_TOKEN / DISCORD_WEBHOOK_URL, which the notification
providers read but nothing documented.

Note on the boot error in the issue: @nestjs/config sets allowUnknown to
true when validationOptions leaves it out, and the schema is checked
against .env merged with process.env, so unknown keys never failed boot.
I made that explicit in config.module.ts and wrote the policy down in
env.validation.ts. The strict check lives in a spec instead, which also
asserts that the schema and .env.example list the same keys.

Closes Chulilee#67
@vercel

vercel Bot commented Sep 30, 2026

Copy link
Copy Markdown

@SungJiinwoo is attempting to deploy a commit to the Akargi Team on Vercel.

A member of the Team first needs to authorize it.

@ykargeee-bit

Copy link
Copy Markdown
Contributor

✅ Ready to merge — all CI checks pass (Build and TypeScript Check ✅). The Vercel deployment failures are authorization issues unrelated to the code changes. This PR adds Stellar gateway configuration to .env.example, reads settings from environment variables, and adds validation/tests for the new config keys. Safe to merge when a maintainer with write access reviews.

@akargi
akargi merged commit 2c3b6b2 into Chulilee:main Oct 2, 2026
1 of 3 checks passed
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.

[Bug] .env.example contains 10 variables that fail Joi validation, so cp .env.example .env cannot boot

3 participants