Skip to content

refactor: migrate REACT_APP_ env vars to OPENSCAN_ prefix#353

Merged
AugustoL merged 1 commit intoopenscan-explorer:devfrom
AugustoL:refactor/migrate-env-vars-to-vite-prefix
Apr 11, 2026
Merged

refactor: migrate REACT_APP_ env vars to OPENSCAN_ prefix#353
AugustoL merged 1 commit intoopenscan-explorer:devfrom
AugustoL:refactor/migrate-env-vars-to-vite-prefix

Conversation

@AugustoL
Copy link
Copy Markdown
Collaborator

@AugustoL AugustoL commented Apr 1, 2026

Description

Migrates all REACT_APP_* environment variables to OPENSCAN_* prefix convention and replaces process.env access with import.meta.env. Adds envPrefix: "OPENSCAN_" to Vite config so env vars are auto-exposed without manual define entries.

Related Issue

Closes #347

Type of Change

  • Bug fix
  • New feature
  • Documentation update
  • Refactoring
  • Performance improvement
  • Other (please describe):

Changes Made

  • vite.config.ts: Added envPrefix: "OPENSCAN_". Reduced define map from 6 entries to 3 (only computed defaults: OPENSCAN_COMMIT_HASH, OPENSCAN_VERSION, OPENSCAN_ENVIRONMENT). Removed manual entries for GITHUB_REPO, OPENSCAN_NETWORKS, and OPENSCAN_WORKER_URL since Vite auto-exposes them.
  • Source files (Footer.tsx, networks.ts, workerConfig.ts, constants.ts, subdomains.ts, home/index.tsx): Replaced process.env.REACT_APP_* / import.meta.env.VITE_* with import.meta.env.OPENSCAN_*.
  • Build scripts (build-production.sh, build-staging.sh, build-development.sh, run-test-env.sh): Updated env var names from REACT_APP_* to OPENSCAN_*.
  • Documentation (README.md, .claude/rules/architecture.md, .claude/rules/commands.md): Updated all env var references.

Checklist

  • I have run npm run format:fix and npm run lint:fix
  • I have run npm run typecheck with no errors
  • I have run tests with npm run test:run
  • I have tested my changes locally
  • I have updated documentation if needed
  • My code follows the project's architecture patterns

Additional Notes

No CI/CD workflow changes needed — GitHub Actions workflows don't reference these env vars directly.

Replace all REACT_APP_* environment variables with OPENSCAN_* prefix
and use import.meta.env instead of process.env for runtime access.
Add envPrefix: "OPENSCAN_" to Vite config so OPENSCAN_* vars are
auto-exposed without manual define entries. Only computed defaults
(COMMIT_HASH, VERSION, ENVIRONMENT) remain in the define map.

Closes openscan-explorer#347
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 1, 2026

🚀 Preview: https://pr-353--openscan.netlify.app
📝 Commit: 3b0997dbda774945b33fd05e623592051a2a6dd8

Copy link
Copy Markdown
Collaborator

@josealoha666 josealoha666 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. The OPENSCAN_ prefix migration is consistent across app code, scripts, and docs, and the remaining define entries are just the computed defaults Vite still needs.

@AugustoL AugustoL merged commit 3317d86 into openscan-explorer:dev Apr 11, 2026
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.

3 participants