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

Add multiple environment support and cleanup #11

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

Conversation

hassancodess
Copy link
Contributor

@hassancodess hassancodess commented Sep 14, 2024

This PR includes the following updates:

  • Improved formatting for environment variables validation errors.
  • Replaced dotenv with dotenvx.
  • Added development and production scripts to package.json.
  • Updated README with instructions for .env.development and .env.production.
  • Added .env.development and .env.production to .gitignore.

Summary by Sourcery

Add support for multiple environments by introducing .env.development and .env.production files, and update the README with relevant instructions. Replace dotenv with dotenvx for better environment variable management and improve error formatting for environment variable validation.

New Features:

  • Introduce support for multiple environments by adding .env.development and .env.production files.

Enhancements:

  • Improve formatting for environment variables validation errors using a custom pretty print function.
  • Replace dotenv with dotenvx for environment variable management.

Documentation:

  • Update README with instructions for setting up .env.development and .env.production files.

Chores:

  • Add .env.development and .env.production to .gitignore to prevent them from being tracked in version control.

Copy link

sourcery-ai bot commented Sep 14, 2024

Reviewer's Guide by Sourcery

This pull request enhances the project's environment configuration management by introducing support for multiple environments, improving error handling, and updating the project setup process. The changes focus on replacing the dotenv library with dotenvx, implementing a more user-friendly error display for environment variable validation, and updating the README with new instructions for environment setup.

File-Level Changes

Change Details Files
Replaced dotenv with dotenvx for improved environment variable management
  • Imported dotenvx instead of dotenv
  • Updated configuration loading to use dotenvx.config()
src/config/config.service.ts
Implemented improved error handling and formatting for environment variable validation
  • Added a prettyPrintErrors function to format ZodError objects
  • Updated config parsing to use safeParse instead of parse
  • Added error logging and process termination on validation failure
  • Exported config.data instead of raw config object
src/config/config.service.ts
Updated README with instructions for multiple environment setups
  • Changed instructions to create .env.development and .env.production files instead of a single .env file
  • Updated the environment variable setup section to reflect the new multi-environment approach
README.md

Tips
  • Trigger a new Sourcery review by commenting @sourcery-ai review on the pull request.
  • Continue your discussion with Sourcery by replying directly to review comments.
  • You can change your review settings at any time by accessing your dashboard:
    • Enable or disable the Sourcery-generated pull request summary or reviewer's guide;
    • Change the review language;
  • You can always contact us if you have any questions or feedback.

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey @hassancodess - I've reviewed your changes and they look great!

Here's what I looked at during the review
  • 🟢 General issues: all looks good
  • 🟡 Security: 1 issue found
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment to tell me if it was helpful.

resolution: {integrity: sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==}
engines: {node: '>=12'}

'@dotenvx/dotenvx@1.14.0':
Copy link

Choose a reason for hiding this comment

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

🚨 suggestion (security): Review usage and security implications of new dependencies

New dependencies like '@dotenvx/dotenvx' and '@noble/ciphers' have been added. Ensure their usage aligns with project requirements and doesn't introduce security vulnerabilities.

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.

2 participants