Skip to content

Create settings.toml#19

Merged
grunch merged 3 commits intomainfrom
issue-1_create-settings.toml
Apr 25, 2025
Merged

Create settings.toml#19
grunch merged 3 commits intomainfrom
issue-1_create-settings.toml

Conversation

@grunch
Copy link
Member

@grunch grunch commented Apr 25, 2025

Fix #1

Also update MostriX logo

Summary by CodeRabbit

  • New Features
    • Introduced a configuration system that loads settings from a user-specific configuration file.
    • Added a default configuration file with options for public key, network relays, and log level.
    • Application now displays loaded configuration at startup for user visibility.
    • Logging verbosity can now be customized via configuration settings.

Fix #1

Also update MostriX logo
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Apr 25, 2025

Caution

Review failed

The pull request is closed.

## Walkthrough

This change introduces a configuration management system to the project. It adds the `config` and `serde` crates as dependencies, creates a `settings.toml` file with three settings (`mostro_pubkey`, `relays`, and `log_level`), and implements logic to load and manage these settings at runtime. A new `Settings` struct is defined and populated from the configuration file using deserialization. The initialization ensures that the configuration file exists in the user's home directory, copying a default if necessary, and makes the settings globally accessible within the application.

## Changes

| File(s)                 | Change Summary                                                                                      |
|------------------------|-----------------------------------------------------------------------------------------------------|
| Cargo.toml             | Added `config` and `serde` dependencies with relevant features.                                     |
| settings.toml          | Introduced with fields: `mostro_pubkey`, `relays`, and `log_level`.                                |
| src/main.rs            | Added logic to initialize, load, and print settings using the new configuration system; modified logger setup to accept log level string.             |
| src/settings.rs        | New module defining `Settings` struct and `init_settings()` for configuration management, including directory and default file setup.            |

## Sequence Diagram(s)

```mermaid
sequenceDiagram
    participant User
    participant Main
    participant Settings
    participant FileSystem

    User->>Main: Start application
    Main->>Settings: Call init_settings()
    Settings->>FileSystem: Check/create config directory and settings.toml
    FileSystem-->>Settings: Ensure settings.toml exists
    Settings->>FileSystem: Read settings.toml
    FileSystem-->>Settings: Return config data
    Settings->>Settings: Deserialize config into Settings struct
    Settings-->>Main: Return Settings reference
    Main->>Main: Use settings (log, print, etc.)

Assessment against linked issues

Objective Addressed Explanation
Create settings.toml (#1)

Possibly related PRs

  • Create settings.toml #19: Introduces the same configuration management system including settings.toml, Settings struct, and global SETTINGS static, making it directly related at the code level.

Poem

In a burrow deep, a file appears—
settings.toml to calm our fears.
With keys and relays snug in place,
And logging set for every case.
Now every hop and every run,
Begins with config—oh what fun!
🐇✨


<!-- walkthrough_end -->
<!-- internal state start -->


<!-- DwQgtGAEAqAWCWBnSTIEMB26CuAXA9mAOYCmGJATmriQCaQDG+Ats2bgFyQAOFk+AIwBWJBrngA3EsgEBPRvlqU0AgfFwA6NPEgQAfACgjoCEYDEZyAAUASpETZWaCrKNwSPbABsvkCiQBHbGlcSHFcLzpIACIAYX9qD0QSXHEMIkQNAmYvaMgAdzRkBwFmdRp6OTDYD2xkviIKbAwGWHRkbm9ffyCQyAxHAUpIAEYATn4sXBrIAFl8RFwKfCsAJisAemYFpfgADz8SbgX1fBcNGBnbdFpaf0Rk5CQHDzMR9Ax6eBavbCVkaYeBgJcT4LD4ABm6HsKTSGSyLF8EPgkQuAEFbup4GC0D5ZAAaaoea7Ybi0RIAmbzRYUeAADUgXnwRHwF3cjFgmFIyG0zDC+EgyIOgMOEMoZAYUWewQ+X2YvHwUiJPGWIjEkCqaEx6QUGGRRGwVFBWGSqW+GVlovuCB1IqZLPaprZVzsDEwGo8/gk8BI+Si1GVAFUbAAZLiwVLcRAcDYbIjqWDYAQaJjMDbUpYrdZbHa0vYbTo+DbjDRGfTGcBQMj0SE4AjEMjKCoKVjsLi8fjCUTiKQyeRMJRUVTqLQ6csmKBwVCod1oPCEUjkI1RVNsDCcPxofL2RzMZzyKoD5TDzTaXRgQwV0wGWLOFkInIcAzRF8GCyQNEASQbS8S9AcTguPwUKtFy0huPkArkNuSjcNWEo+sgnJKkMZA3Eo9AEMqt4UPe2RIiitSfMMIoANqwfBLSIQAujCYjYhgXAAAZMHq8BEExkBSBQiAMZAAAMGgjAArEJ7z5AmyrRPheRitQhoeGQKiRLQhKYPQTH1EonHcbxYKjBogmrOMBSSSK0SDpIJCySQ8n+JASkCCpFwAHIC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SbGOfJY9m+cSA4yRZ4lJ6ETlVXlpEc4sCNBDj8BOMHv8SgqTsac2VGZizgpCJIPdjMOjor1ZLDG4SfwZSTo6kNv4Gd0OIUzH8xrqIQXBAhZ/UYe9pVKm0Gxjqac8pIhrmbN6PpW9LsCx8JSAMyUyilI8Ez5YqC+SsbaP8YE8AGlWVBf9rbTwoQijRmwAX2O5tugwMc0IQxBT4GaKpZUVmVGc7L5gSvHpPu2QqKstOJAM405cbrpa5e2/V/JxWwkRKC+ALBE3SLSPUDMwq1EUqGcUSSIM+r9JmS54fgXg6g3vW7U5WNBvKETrQlhV9VVcIiEywfljfQGjlVRvqiNwVziqfddh1oNGAwkBdA3R8ZPTwxcBabmhMR/4AHiY/TXRyYMAKbaZECcKQFQCqbqagygHNIQExo+pVolb6RMQbraL5btSTq6CnoHpdbxo4z0btRCZt7DSvQaQyyEgCB4DoB1L/bwBOQeCp6SyQrLiArPgXzlgGAThVQ9J1gLhAZ/gtjB5cBUDbhDQ/yHiKDHhqCnhjgXhiGVhyF5ZzKID3Reg+h+i0C6JHTFTniXjiEADMZM/EDAJMJMDA/EqwAgAAHAAOxjDCTuG+Eky0BkwCC0AMACA2HeECBjCrD8RjAqB0BeGBFWE6EQAairDCT8TkhoDuFjCeEZyeFkyrBkxjBhFagQi0C5EQgkwkBVHkgQhRFuhuH0CiHiGrj6E/5GHtImF0D3TVhWFAA -->

<!-- internal state end -->

---

<details>
<summary>📜 Recent review details</summary>

**Configuration used: CodeRabbit UI**
**Review profile: CHILL**
**Plan: Pro**

<details>
<summary>📥 Commits</summary>

Reviewing files that changed from the base of the PR and between b250daa897fa74249b3adfd7ff6e6edaf92ca2bd and 24a7dfde457b885bb643cd17578e37af3776e7c0.

</details>

<details>
<summary>📒 Files selected for processing (1)</summary>

* `src/main.rs` (4 hunks)

</details>

</details>
<!-- finishing_touch_checkbox_start -->

<details open="true">
<summary>✨ Finishing Touches</summary>

- [ ] <!-- {"checkboxId": "7962f53c-55bc-4827-bfbf-6a18da830691"} --> 📝 Generate Docstrings

</details>

<!-- finishing_touch_checkbox_end -->
<!-- tips_start -->

---

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.

<details>
<summary>❤️ Share</summary>

- [X](https://twitter.com/intent/tweet?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A&url=https%3A//coderabbit.ai)
- [Mastodon](https://mastodon.social/share?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A%20https%3A%2F%2Fcoderabbit.ai)
- [Reddit](https://www.reddit.com/submit?title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&text=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code.%20Check%20it%20out%3A%20https%3A//coderabbit.ai)
- [LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fcoderabbit.ai&mini=true&title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&summary=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code)

</details>

<details>
<summary>🪧 Tips</summary>

### Chat

There are 3 ways to chat with [CodeRabbit](https://coderabbit.ai?utm_source=oss&utm_medium=github&utm_campaign=MostroP2P/mostrix&utm_content=19):

- Review comments: Directly reply to a review comment made by CodeRabbit. Example:
  - `I pushed a fix in commit <commit_id>, please review it.`
  - `Generate unit testing code for this file.`
  - `Open a follow-up GitHub issue for this discussion.`
- 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 gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.`
  - `@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 using 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 generate docstrings` to [generate docstrings](https://docs.coderabbit.ai/finishing-touches/docstrings) for this PR.
- `@coderabbitai generate sequence diagram` to generate a sequence diagram of the changes in this 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.

### Other keywords and placeholders

- Add `@coderabbitai ignore` anywhere in the PR description to prevent this PR from being reviewed.
- Add `@coderabbitai summary` to generate the high-level summary at a specific location in the PR description.
- Add `@coderabbitai` anywhere in the PR title to generate the title automatically.

### CodeRabbit Configuration 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](https://docs.coderabbit.ai/guides/configure-coderabbit) 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](https://docs.coderabbit.ai) for detailed information on how to use CodeRabbit.
- Join our [Discord Community](http://discord.gg/coderabbit) to get help, request features, and share feedback.
- Follow us on [X/Twitter](https://twitter.com/coderabbitai) for updates and announcements.

</details>

<!-- tips_end -->

Copy link
Contributor

@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: 6

🔭 Outside diff range comments (2)
src/main.rs (2)

302-306: ⚠️ Potential issue

Use relays from settings

The code currently hardcodes a single relay URL instead of using the relays defined in the settings.

    // Configure Nostr client.
    let my_keys = Keys::generate();
    let client = Client::new(my_keys);
    // Add the Mostro relay.
-    client.add_relay("wss://relay.mostro.network").await?;
+    // Add all relays from settings
+    for relay in &settings.relays {
+        client.add_relay(relay).await?;
+    }
    client.connect().await;

309-311: ⚠️ Potential issue

Use mostro_pubkey from settings

The Mostro public key is hardcoded instead of using the value from settings.

    // Hardcoded Mostro Pubkey.
-    let mostro_pubkey_str = "82fa8cb978b43c79b2156585bac2c011176a21d2aead6d9f7c575c005be88390";
+    let mostro_pubkey_str = &settings.mostro_pubkey;
    let mostro_pubkey = PublicKey::from_str(mostro_pubkey_str)
        .map_err(|e| anyhow::anyhow!("Invalid Mostro pubkey: {}", e))?;
🧰 Tools
🪛 Gitleaks (8.21.2)

309-309: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)

🧹 Nitpick comments (1)
src/settings.rs (1)

16-18: Document purpose of the static variable

The comment is in Spanish. Consider translating it to English for consistency and to make it more broadly understandable.

-// Variable global, solamente se inicializa una vez
+// Global variable that is initialized only once
static SETTINGS: OnceLock<Settings> = OnceLock::new();
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4332fad and 340c66c.

⛔ Files ignored due to path filters (2)
  • Cargo.lock is excluded by !**/*.lock
  • static/logo.png is excluded by !**/*.png
📒 Files selected for processing (4)
  • Cargo.toml (1 hunks)
  • settings.toml (1 hunks)
  • src/main.rs (3 hunks)
  • src/settings.rs (1 hunks)
🔇 Additional comments (2)
Cargo.toml (1)

23-24: Dependencies look good

The addition of the config and serde crates with appropriate features is a good choice for implementing the configuration management system.

src/settings.rs (1)

1-8: Good module organization

The imports are well-organized and the module structure is clean. Using once_cell::sync::OnceLock is a good choice for lazy initialization of a global value.

@grunch grunch merged commit a60762f into main Apr 25, 2025
@grunch grunch deleted the issue-1_create-settings.toml branch April 25, 2025 21:01
Copy link
Contributor

@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: 0

🧹 Nitpick comments (4)
src/settings.rs (4)

22-22: Translate the Spanish example comment

For consistency, translate the Spanish example comment "p.e." to English.

-        let package_name  = env!("CARGO_PKG_NAME");          // p.e. "my_project"
+        let package_name  = env!("CARGO_PKG_NAME");          // e.g. "my_project"

18-51: Improve error handling with Result instead of expect

The current implementation uses expect() which terminates the program if an error occurs. Consider returning a Result type for more graceful error handling, especially for a configuration function that might be called during startup.

Here's how you could refactor the function:

-pub fn init_settings() -> &'static Settings {
+pub fn init_settings() -> Result<&'static Settings, String> {
     SETTINGS.get_or_init(|| {
-        let home_dir = dirs::home_dir().expect("Could not find home directory");
+        let home_dir = dirs::home_dir().ok_or("Could not find home directory")?;
         let package_name  = env!("CARGO_PKG_NAME");          // e.g. "my_project"
         let hidden_dir    = home_dir.join(format!(".{package_name}"));
         let hidden_file   = hidden_dir.join("settings.toml");

         // Path to the settings.toml included in the repo (next to Cargo.toml)
         let default_file: PathBuf =
             Path::new(env!("CARGO_MANIFEST_DIR")).join("settings.toml");

         // Create ~/.mostrix if it doesn't exist
         if !hidden_dir.exists() {
-            fs::create_dir(&hidden_dir)
-                .expect("The configuration directory could not be created");
+            fs::create_dir(&hidden_dir)
+                .map_err(|e| format!("The configuration directory could not be created: {}", e))?;
         }

         // Copy settings.toml if it isn't already in ~/.mostrix
         if !hidden_file.exists() {
-            fs::copy(&default_file, &hidden_file)
-                .expect("Could not copy default settings.toml");
+            fs::copy(&default_file, &hidden_file)
+                .map_err(|e| format!("Could not copy default settings.toml: {}", e))?;
         }

         // Use the `config` crate to deserialize to the Settings struct
         let cfg = config::Config::builder()
             .add_source(config::File::from(hidden_file))
             .build()
-            .expect("settings.toml malformed");
+            .map_err(|e| format!("settings.toml malformed: {}", e))?;

-        cfg.try_deserialize::<Settings>()
-            .expect("Error deserializing settings.toml")
+        cfg.try_deserialize::<Settings>()
+            .map_err(|e| format!("Error deserializing settings.toml: {}", e))
     })
+    .map_err(|e| e)
}

This approach would allow the caller to handle configuration errors more gracefully, possibly by logging them and using default values, rather than terminating the program.


10-15: Consider adding validation for settings

The Settings struct currently just deserializes the values without any validation. Consider adding validation for fields like log_level to ensure they contain valid values.

You could implement this by adding a validate method to the Settings struct:

impl Settings {
    /// Validates the settings values
    pub fn validate(&self) -> Result<(), String> {
        // Validate log_level
        match self.log_level.to_lowercase().as_str() {
            "trace" | "debug" | "info" | "warn" | "error" => Ok(()),
            _ => Err(format!("Invalid log_level: {}", self.log_level))
        }
        
        // Add more validation for other fields as needed
    }
}

Then call this from the init_settings function after deserializing.


18-51: Use constants for fixed values

The code uses string literals like "settings.toml" in multiple places. Consider defining these as constants at the top of the file to improve maintainability.

use serde::Deserialize;
use std::{
    env,
    fs,
    path::{Path, PathBuf},
};
use dirs;

+const SETTINGS_FILENAME: &str = "settings.toml";

#[derive(Debug, Deserialize)]
pub struct Settings {
    // ...
}

pub fn init_settings() -> &'static Settings {
    SETTINGS.get_or_init(|| {
        // ...
-        let hidden_file   = hidden_dir.join("settings.toml");
+        let hidden_file   = hidden_dir.join(SETTINGS_FILENAME);
        
        // Path to the settings.toml included in the repo (next to Cargo.toml)
        let default_file: PathBuf =
-            Path::new(env!("CARGO_MANIFEST_DIR")).join("settings.toml");
+            Path::new(env!("CARGO_MANIFEST_DIR")).join(SETTINGS_FILENAME);
        // ...
    })
}
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 340c66c and b250daa.

📒 Files selected for processing (2)
  • src/main.rs (4 hunks)
  • src/settings.rs (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/main.rs
🔇 Additional comments (1)
src/settings.rs (1)

1-8: 🛠️ Refactor suggestion

Add missing import for the dirs crate

The code uses dirs::home_dir() on line 21, but there's no import for the dirs crate.

use crate::SETTINGS;

use serde::Deserialize;
use std::{
    env,
    fs,
    path::{Path, PathBuf},
};
+use dirs;

Likely an incorrect or invalid review comment.

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.

Create settings.toml

1 participant