Skip to content

centralize API base selection and environment-aware fetching - #305

Open
veemakama wants to merge 2 commits into
BlockDash-Studios:mainfrom
veemakama:main
Open

centralize API base selection and environment-aware fetching#305
veemakama wants to merge 2 commits into
BlockDash-Studios:mainfrom
veemakama:main

Conversation

@veemakama

Copy link
Copy Markdown
Contributor

Changes Made:

  1. Centralized API URL Handling : Updated src/lib/api.ts with three typed functions for consistent URL handling:

    • getRustAcademyApiBase() : Public/browser API base URL
    • getRustAcademyInternalApiBase() : Server-side/internal API base URL
    • getSiteUrl() : For OpenGraph metadata and site links (with fallback logic)
  2. Updated src/lib/og-metadata.ts : Replaced direct environment variable usage and duplicate getSiteUrl() implementation with the centralized functions. ### Impacted Files Check:

  • ✅ app/frontend/src/lib/api.ts : Updated with centralized functions
  • ✅ app/frontend/src/app/settings/developer/page.tsx : Already using getRustAcademyApiBase()
  • ✅ app/frontend/src/components/admin/AuditLogs.tsx : Already using getRustAcademyApiBase()
  • ✅ app/frontend/src/components/admin/FeatureFlags.tsx : Already using getRustAcademyApiBase()
  • ✅ app/frontend/src/lib/errorReporter.ts : No API base URL usage
  • ✅ app/frontend/next.config.ts : Just passes through environment variables (no duplication) The codebase now has a single source of truth for API base URLs, preventing inconsistent environments!

Closes #291

### Changes Made:
1. Centralized API URL Handling : Updated src/lib/api.ts with three typed functions for consistent URL handling:

   - getRustAcademyApiBase() : Public/browser API base URL
   - getRustAcademyInternalApiBase() : Server-side/internal API base URL
   - getSiteUrl() : For OpenGraph metadata and site links (with fallback logic)
2. Updated src/lib/og-metadata.ts : Replaced direct environment variable usage and duplicate getSiteUrl() implementation with the centralized functions.
### Impacted Files Check:
- ✅ app/frontend/src/lib/api.ts : Updated with centralized functions
- ✅ app/frontend/src/app/settings/developer/page.tsx : Already using getRustAcademyApiBase()
- ✅ app/frontend/src/components/admin/AuditLogs.tsx : Already using getRustAcademyApiBase()
- ✅ app/frontend/src/components/admin/FeatureFlags.tsx : Already using getRustAcademyApiBase()
- ✅ app/frontend/src/lib/errorReporter.ts : No API base URL usage
- ✅ app/frontend/next.config.ts : Just passes through environment variables (no duplication)
The codebase now has a single source of truth for API base URLs, preventing inconsistent environments!
@MaryammAli

Copy link
Copy Markdown
Contributor

@veemakama
this is not the issue description , kindly read the issue description to implement the issue

Updated file project
MaryammAli pushed a commit that referenced this pull request Jul 23, 2026
- Add comprehensive fee configuration section to README.md explaining:
  * Fee resolution priority (per-asset > oracle > global)
  * Global fee configuration with examples
  * Per-asset fee overrides and use cases
  * Arbiter splits (both legacy and explicit FeeRatio)
  * Collector rotation mechanism
  * Fee breakdown structure

- Create FEE_CONFIGURATION_GUIDE.md with:
  * Detailed examples for all fee configuration patterns
  * Common use cases and patterns
  * Troubleshooting guide
  * FeeRatio validation rules

- Enhance inline documentation in lib.rs:
  * Add detailed docstrings for set_fee_config()
  * Expand set_per_asset_fee() with priority order, fee distribution, and examples
  * Add clear documentation for get_per_asset_fee()

- Enhance admin.rs documentation:
  * Document set_fee_config() with fallback priority
  * Document set_per_asset_fee() with fee split options and validation
  * Add comprehensive error cases

This fully surfaces the per-asset fee override functionality that was
previously declared in storage but not well-documented or easily discoverable.

Fixes: Issue #305 (Fee Router v2 - per-asset overrides now fully documented)
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.

centralize API base selection and environment-aware fetching

2 participants