Skip to content

Commit b7380dc

Browse files
authored
feat: Add tos_url to mintd config (#636)
* feat: Add tos_url to mintd config * docs: tos in change log
1 parent fcf2e9d commit b7380dc

File tree

6 files changed

+21
-0
lines changed

6 files changed

+21
-0
lines changed

CHANGELOG.md

+3
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
### Added
1414
- Added redb feature to mintd in order to meet MSRV target ([thesimplekid]).
1515
- cdk-sqlite: In memory sqlite database ([crodas]).
16+
- Add `tos_url` to `MintInfo` ([nodlAndHodl]).
17+
- cdk: Add tos_url setter to `MintBuilder` ([thesimplekid]).
1618
### Removed
1719
- Remove support for Memory Database in cdk ([crodas]).
1820
- Remove `AmountStr` ([crodas]).
@@ -276,3 +278,4 @@ Additionally, this release introduces a Mint binary cdk-mintd that uses the cdk-
276278
[crodas]: https://github.com/crodas
277279
[tdelabro]: https://github.com/tdelabro
278280
[daywalker90]: https://github.com/daywalker90
281+
[nodlAndHodl]: https://github.com/nodlAndHodl

crates/cdk-mintd/example.config.toml

+1
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ tti = 60
3434
# contact_email = "hello@cashu.me"
3535
# Nostr pubkey of mint (Hex)
3636
# contact_nostr_public_key = ""
37+
# tos_url = "https://example.com/terms-of-service"
3738

3839

3940
[database]

crates/cdk-mintd/src/config.rs

+2
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,8 @@ pub struct MintInfo {
208208
pub contact_nostr_public_key: Option<String>,
209209
/// Contact email
210210
pub contact_email: Option<String>,
211+
/// URL to the terms of service
212+
pub tos_url: Option<String>,
211213
}
212214

213215
#[cfg(feature = "management-rpc")]

crates/cdk-mintd/src/env_vars.rs

+5
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ pub const ENV_MINT_ICON_URL: &str = "CDK_MINTD_MINT_ICON_URL";
3232
pub const ENV_MINT_MOTD: &str = "CDK_MINTD_MINT_MOTD";
3333
pub const ENV_MINT_CONTACT_NOSTR: &str = "CDK_MINTD_MINT_CONTACT_NOSTR";
3434
pub const ENV_MINT_CONTACT_EMAIL: &str = "CDK_MINTD_MINT_CONTACT_EMAIL";
35+
pub const ENV_MINT_TOS_URL: &str = "CDK_MINTD_MINT_TOS_URL";
3536
// LN
3637
pub const ENV_LN_BACKEND: &str = "CDK_MINTD_LN_BACKEND";
3738
pub const ENV_LN_INVOICE_DESCRIPTION: &str = "CDK_MINTD_LN_INVOICE_DESCRIPTION";
@@ -203,6 +204,10 @@ impl MintInfo {
203204
self.contact_email = Some(email);
204205
}
205206

207+
if let Ok(tos_url) = env::var(ENV_MINT_TOS_URL) {
208+
self.tos_url = Some(tos_url);
209+
}
210+
206211
self
207212
}
208213
}

crates/cdk-mintd/src/main.rs

+4
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,10 @@ async fn main() -> anyhow::Result<()> {
263263
mint_builder = mint_builder.with_motd(motd);
264264
}
265265

266+
if let Some(tos_url) = &settings.mint_info.tos_url {
267+
mint_builder = mint_builder.with_tos_url(tos_url.to_string());
268+
}
269+
266270
let mnemonic = Mnemonic::from_str(&settings.info.mnemonic)?;
267271

268272
mint_builder = mint_builder

crates/cdk/src/mint/builder.rs

+6
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,12 @@ impl MintBuilder {
8686
self
8787
}
8888

89+
/// Set terms of service URL
90+
pub fn with_tos_url(mut self, tos_url: String) -> Self {
91+
self.mint_info.tos_url = Some(tos_url);
92+
self
93+
}
94+
8995
/// Set description
9096
pub fn with_description(mut self, description: String) -> Self {
9197
self.mint_info.description = Some(description);

0 commit comments

Comments
 (0)