Skip to content

Auto-generate settings.toml with sensible defaults on first run #40

@mostronatorcoder

Description

@mostronatorcoder

Problem

Currently, if a user downloads the mostrix binary and runs it from the terminal, it fails because there is no settings.toml file present.

This creates a poor first-run experience — users have to manually create a config file before they can use the app.

Expected Behavior

Mostrix should handle missing configuration gracefully:

1. Look for settings.toml in the binary's directory

First, check if settings.toml exists in the same directory where the binary is located.

2. Auto-generate with sensible defaults if not found

If no config file exists, create settings.toml dynamically with these defaults:

# Auto-generated mostrix configuration

# User's private key (newly generated)
nsec = "<newly_generated_nsec>"

# Default relay
relays = ["wss://relay.mostro.network"]

# User mode (not admin/solver)
user_mode = "user"

# No proof-of-work required
pow = 0

# No currency filter (show all)
currencies_filter = []

# Official Mostro daemon pubkey
mostro_pubkey = "82fa8cb978b43c79b2156585bac2c022276a21d2aead6d9f7c575c005be88390"

# Other values use existing defaults from settings.toml template

Implementation Notes

  • Generate a new Nostr keypair for the user on first run
  • Store the generated settings.toml in the same directory as the binary
  • Log a message informing the user that a new config was created
  • Consider showing the generated npub so users know their identity

Benefits

  • Zero-config first run — download, run, trade
  • Better UX — no manual file creation needed
  • Secure defaults — fresh keypair, official relay and Mostro pubkey

Related

  • Current settings.toml template for reference to other default values

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions