Skip to content

Commit

Permalink
feat: Add tos_url to mintd config (#636)
Browse files Browse the repository at this point in the history
* feat: Add tos_url to mintd config

* docs: tos in change log
  • Loading branch information
thesimplekid authored Mar 7, 2025
1 parent fcf2e9d commit b7380dc
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 0 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
### Added
- Added redb feature to mintd in order to meet MSRV target ([thesimplekid]).
- cdk-sqlite: In memory sqlite database ([crodas]).
- Add `tos_url` to `MintInfo` ([nodlAndHodl]).
- cdk: Add tos_url setter to `MintBuilder` ([thesimplekid]).
### Removed
- Remove support for Memory Database in cdk ([crodas]).
- Remove `AmountStr` ([crodas]).
Expand Down Expand Up @@ -276,3 +278,4 @@ Additionally, this release introduces a Mint binary cdk-mintd that uses the cdk-
[crodas]: https://github.com/crodas
[tdelabro]: https://github.com/tdelabro
[daywalker90]: https://github.com/daywalker90
[nodlAndHodl]: https://github.com/nodlAndHodl
1 change: 1 addition & 0 deletions crates/cdk-mintd/example.config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ tti = 60
# contact_email = "[email protected]"
# Nostr pubkey of mint (Hex)
# contact_nostr_public_key = ""
# tos_url = "https://example.com/terms-of-service"


[database]
Expand Down
2 changes: 2 additions & 0 deletions crates/cdk-mintd/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,8 @@ pub struct MintInfo {
pub contact_nostr_public_key: Option<String>,
/// Contact email
pub contact_email: Option<String>,
/// URL to the terms of service
pub tos_url: Option<String>,
}

#[cfg(feature = "management-rpc")]
Expand Down
5 changes: 5 additions & 0 deletions crates/cdk-mintd/src/env_vars.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ pub const ENV_MINT_ICON_URL: &str = "CDK_MINTD_MINT_ICON_URL";
pub const ENV_MINT_MOTD: &str = "CDK_MINTD_MINT_MOTD";
pub const ENV_MINT_CONTACT_NOSTR: &str = "CDK_MINTD_MINT_CONTACT_NOSTR";
pub const ENV_MINT_CONTACT_EMAIL: &str = "CDK_MINTD_MINT_CONTACT_EMAIL";
pub const ENV_MINT_TOS_URL: &str = "CDK_MINTD_MINT_TOS_URL";
// LN
pub const ENV_LN_BACKEND: &str = "CDK_MINTD_LN_BACKEND";
pub const ENV_LN_INVOICE_DESCRIPTION: &str = "CDK_MINTD_LN_INVOICE_DESCRIPTION";
Expand Down Expand Up @@ -203,6 +204,10 @@ impl MintInfo {
self.contact_email = Some(email);
}

if let Ok(tos_url) = env::var(ENV_MINT_TOS_URL) {
self.tos_url = Some(tos_url);
}

self
}
}
Expand Down
4 changes: 4 additions & 0 deletions crates/cdk-mintd/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,10 @@ async fn main() -> anyhow::Result<()> {
mint_builder = mint_builder.with_motd(motd);
}

if let Some(tos_url) = &settings.mint_info.tos_url {
mint_builder = mint_builder.with_tos_url(tos_url.to_string());
}

let mnemonic = Mnemonic::from_str(&settings.info.mnemonic)?;

mint_builder = mint_builder
Expand Down
6 changes: 6 additions & 0 deletions crates/cdk/src/mint/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,12 @@ impl MintBuilder {
self
}

/// Set terms of service URL
pub fn with_tos_url(mut self, tos_url: String) -> Self {
self.mint_info.tos_url = Some(tos_url);
self
}

/// Set description
pub fn with_description(mut self, description: String) -> Self {
self.mint_info.description = Some(description);
Expand Down

0 comments on commit b7380dc

Please sign in to comment.