Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(ensrainbow): refine handling of env vars #367

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

Byczong
Copy link

@Byczong Byczong commented Mar 12, 2025

#118

Refactor env vars, CLI args and configuration handling

This PR introduces a more standardized and modular approach to handling environment variables, command-line arguments, and configuration in ENSRainbow.

Changes

  • Removed old lib/env.ts file
  • Added new utility modules:
    • apps/ensrainbow/src/utils/config.ts - Central configuration constants
    • apps/ensrainbow/src/utils/parsing-utils.ts - Pure parsing functions
    • apps/ensrainbow/src/utils/env-utils.ts - Environment variable handling
    • apps/ensrainbow/src/utils/command-utils.ts - CLI argument handling
  • Modified files:
    • apps/ensrainbow/src/utils/logger.ts - Updated to use new config.ts, moved some code to the new utils files
    • apps/ensrainbow/src/cli.ts - Refactored to use the new argument resolution utilities
  • Added tests for the new modules

@Byczong Byczong requested a review from a team as a code owner March 12, 2025 13:44
Copy link

vercel bot commented Mar 12, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
admin.ensnode.io ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 17, 2025 3:57pm
ensadmin-next ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 17, 2025 3:57pm
ensnode.io ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 17, 2025 3:57pm
ensrainbow.io ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 17, 2025 3:57pm

logger.info(`Removing database directory at ${dataDir}...`);
await rm(dataDir, { recursive: true, force: true });
logger.info("Database directory removed successfully.");
if (dirExists) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice one 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ensrainbow ENSRainbow related
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ENSRainbow: Refine handling of invalid ENV vars
2 participants