Skip to content

Conversation

@grunch
Copy link
Member

@grunch grunch commented Nov 25, 2025

Code refactoring

Summary by CodeRabbit

  • Documentation

    • Updated installation to support direct crate install and manual build notes.
    • Renamed env/flag from MOSTROPUBKEY to MOSTRO_PUBKEY across examples and help text.
    • Added POW guidance, admin note for ADMIN_NSEC, adjusted example relay lists and progress checklist.
  • Chores

    • Removed dotenvy dependency and stopped automatic .env loading; environment variables are now read from the standard environment.

✏️ Tip: You can customize this high-level summary in your review settings.

Code refactoring
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 25, 2025

Walkthrough

This PR removes the dotenvy dependency, deletes automatic .env loading from startup, switches environment access to Rust's std::env::var in utilities, and updates README and .env-sample to reflect the new env-var names and installation instructions.

Changes

Cohort / File(s) Summary
Dependency removal
Cargo.toml
Removed dotenvy from [dependencies].
Binary / startup
src/main.rs
Removed the dotenvy::dotenv() initialization call; process no longer auto-loads a .env file at startup.
Env var accessor updates
src/util/messaging.rs, src/util/net.rs
Replaced imports of dotenvy::var with std::env::var; call sites remain unchanged.
Documentation & samples
README.md, .env-sample
Updated install/build instructions and example commands; renamed MOSTROPUBKEYMOSTRO_PUBKEY in docs; removed sample env entries from .env-sample; added notes about ADMIN_NSEC and POW in examples; adjusted progress checklist statuses.

Sequence Diagram(s)

No sequence diagram provided — changes are limited to dependency removal and simple env-access refactors with no new control flow.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

  • Homogeneous, small-scope refactor (dependency removal + stdlib swap) and doc updates.
  • Files to spot-check:
    • src/main.rs — ensure removing dotenv initialization doesn't break expected runtime behavior.
    • src/util/messaging.rs and src/util/net.rs — confirm std::env::var error messages/semantics are acceptable.
    • README.md / .env-sample — verify examples and variable names match runtime expectations.

Possibly related PRs

  • mostro-cli#149 — touches environment-variable handling and ADMIN_NSEC naming; likely related to env-var naming/usage changes.

Suggested reviewers

  • arkanoider
  • Catrya

Poem

🐰 I hopped through code to make things small,
Removed a crate, then bounced down the hall.
std::env now finds the key,
Lighter builds — a happier me,
Tiny change, but spring for all! 🥕

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title directly and clearly summarizes the main change: removal of the dotenvy dependency from Cargo.toml, main.rs, and utility modules, replacing it with std::env::var.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch remove-dotenv

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 97079fc and a57ce64.

⛔ Files ignored due to path filters (1)
  • static/logo.png is excluded by !**/*.png
📒 Files selected for processing (4)
  • .env-sample (0 hunks)
  • README.md (5 hunks)
  • src/util/messaging.rs (1 hunks)
  • src/util/net.rs (1 hunks)
💤 Files with no reviewable changes (1)
  • .env-sample
✅ Files skipped from review due to trivial changes (1)
  • README.md
🚧 Files skipped from review as they are similar to previous changes (2)
  • src/util/net.rs
  • src/util/messaging.rs
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: build

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

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: 3

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 07f54fd and 97079fc.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (5)
  • Cargo.toml (0 hunks)
  • README.md (4 hunks)
  • src/main.rs (0 hunks)
  • src/util/messaging.rs (1 hunks)
  • src/util/net.rs (1 hunks)
💤 Files with no reviewable changes (2)
  • src/main.rs
  • Cargo.toml
🧰 Additional context used
🧠 Learnings (2)
📚 Learning: 2025-09-09T19:18:57.161Z
Learnt from: arkanoider
Repo: MostroP2P/mostro-cli PR: 135
File: src/cli/add_invoice.rs:57-79
Timestamp: 2025-09-09T19:18:57.161Z
Learning: arkanoider prefers to bubble up errors with anyhow::Result instead of using tokio::spawn with eprintln! error handling in Nostr DM sending scenarios, as the spawn is often overkill for simple send operations.

Applied to files:

  • src/util/net.rs
📚 Learning: 2025-09-12T20:02:14.291Z
Learnt from: arkanoider
Repo: MostroP2P/mostro-cli PR: 135
File: src/cli.rs:301-306
Timestamp: 2025-09-12T20:02:14.291Z
Learning: The mostro-cli is designed as a test client that allows users to test both regular user operations and admin operations from the terminal. Therefore, MOSTRO_PUBKEY should always be required regardless of whether NSEC_PRIVKEY is present, as both user and admin operations need to know which Mostro instance to interact with.

Applied to files:

  • README.md
🧬 Code graph analysis (2)
src/util/messaging.rs (1)
src/cli.rs (1)
  • std (398-402)
src/util/net.rs (2)
src/cli.rs (1)
  • std (398-402)
src/util/messaging.rs (1)
  • var (214-216)
🪛 GitHub Actions: CI Mostro-cli
src/util/messaging.rs

[error] 1-1: rustfmt check failed. Formatting differences detected. Run 'cargo fmt' to fix.


[error] 8-8: rustfmt check failed. Formatting differences detected. Run 'cargo fmt' to fix.

src/util/net.rs

[error] 1-1: rustfmt check failed. Formatting differences detected. Run 'cargo fmt' to fix.

@grunch grunch merged commit 2dec619 into main Nov 25, 2025
6 checks passed
@grunch grunch deleted the remove-dotenv branch November 25, 2025 15:25
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