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

fix: make use of config.toml, implement config_path as argument #49

Merged
merged 4 commits into from
Jul 10, 2024

Conversation

sebasti810
Copy link
Contributor

@sebasti810 sebasti810 commented Jul 8, 2024

Changes

  1. Configuration Prioritization (make really use of it):
  • Command-line arguments take the highest priority.
  • If not provided, values are sourced from the config.toml file.
  • Any missing values are filled with default values.
  1. Custom Configuration Path:
  • A custom path for the config.toml file can now be specified via a command-line argument.
  • By default, the configuration file is expected at ./deimos/config.toml.
  1. Automatic Configuration File Creation:
  • If the config.toml file does not exist at the specified/default path, it will be automatically created with the current default values.
  1. Partial Configuration:
  • It is now possible to define only a subset of configuration parameters in the config.toml file.
  • Any unspecified parameters will "fall back" to their default values.

@distractedm1nd TODO: Readme / example config.toml? Or not necessary because of the automatic creation of the default one

Copy link

coderabbitai bot commented Jul 8, 2024

Walkthrough

This update introduces configuration management enhancements to the codebase, including the addition of toml and dirs dependencies, making the log_level an optional field, and refining the configuration loading and merging processes. Several structs were updated with serialization traits, and both error handling and initialization procedures were refined.

Changes

File Change Summary
Cargo.toml Added toml and dirs dependencies.
src/cfg.rs Enhanced configuration handling: added ConfigError, updated struct serialization, and improved initialization logic.
src/main.rs Modified environment variable setting for log_level.
src/node_types.rs Updated error handling and logging formats for LightClient and Sequencer.

Sequence Diagram(s)

The changes are too varied and minor in terms of control flow to warrant the generation of meaningful sequence diagrams.


Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between af8739b and fa12d8e.

Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
Files selected for processing (2)
  • Cargo.toml (1 hunks)
  • src/cfg.rs (7 hunks)
Files skipped from review as they are similar to previous changes (2)
  • Cargo.toml
  • src/cfg.rs

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

‼️ IMPORTANT
Auto-reply has been disabled for this repository in the CodeRabbit settings. The CodeRabbit bot will not respond to your replies unless it is explicitly tagged.

  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

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 as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

src/main.rs Show resolved Hide resolved
src/cfg.rs Outdated Show resolved Hide resolved
@sebasti810 sebasti810 marked this pull request as ready for review July 9, 2024 06:54
@sebasti810 sebasti810 changed the title fix(WIP): make use of config.toml, implement config_path as argument fix: make use of config.toml, implement config_path as argument Jul 9, 2024
src/cfg.rs Outdated Show resolved Hide resolved
src/cfg.rs Outdated Show resolved Hide resolved
src/main.rs Show resolved Hide resolved
@distractedm1nd distractedm1nd merged commit b5f801d into main Jul 10, 2024
@sebasti810 sebasti810 deleted the fix-config branch July 10, 2024 14:07
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