fix: embed .env.example and core configs into the binary#331
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Pull Request Overview
This PR introduces functionality to embed bundled resource files (such as .env.example and Dash core configuration files) into the binary, streamlining configuration file management for different Dash network environments.
- Added a new BundledResource enum for resource management.
- Refactored configuration file handling to utilize the new abstraction in both app_dir.rs and backend_task/core/start_dash_qt.rs.
- Updated the project structure by adding the bundled module in main.rs.
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/main.rs | Added the bundled module to support embedded resource management. |
| src/bundled.rs | Introduced the BundledResource enum and associated helper methods to load and write files. |
| src/backend_task/core/start_dash_qt.rs | Updated configuration file determination logic to use create_dash_core_config_if_not_exists. |
| src/app_dir.rs | Refactored env file copying and added dynamic creation of Dash core configuration files. |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This pull request introduces functionality to manage bundled resources and streamline configuration file handling for different Dash network environments. The changes include adding a new
BundledResourceenum to encapsulate bundled resources, refactoring methods to use this new abstraction, and updating logic for creating and managing configuration files.Bundled Resource Management:
src/bundled.rs: Introduced theBundledResourceenum to represent bundled resources such as.env.exampleand Dash core configuration files. Added methods to load resources as byte slices and write them to files, including directory creation when necessary.Configuration File Handling:
src/app_dir.rs: Refactoredcopy_env_file_if_not_existsto useBundledResource::DotEnvExamplefor copying the.env.examplefile. Addedcreate_dash_core_config_if_not_existsto dynamically generate Dash core configuration files based on the network.src/backend_task/core/start_dash_qt.rs: Updated logic to usecreate_dash_core_config_if_not_existsfor determining and creating Dash core configuration files, replacing hardcoded paths.Codebase Enhancements:
src/app_dir.rs: Improved imports by grouping and addingstd::ioandcrate::bundled::BundledResource.src/main.rs: Added thebundledmodule to the project structure for managing bundled resources.