Skip to content

Commit

Permalink
feat: mintd from enc vars
Browse files Browse the repository at this point in the history
  • Loading branch information
thesimplekid authored and vnprc committed Dec 18, 2024
1 parent 64faa77 commit 879e8c4
Show file tree
Hide file tree
Showing 5 changed files with 480 additions and 2 deletions.
6 changes: 5 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 28 additions & 0 deletions crates/cdk-mintd/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,22 @@ pub enum LnBackend {
Lnd,
}

impl std::str::FromStr for LnBackend {
type Err = String;

fn from_str(s: &str) -> Result<Self, Self::Err> {
match s.to_lowercase().as_str() {
"cln" => Ok(LnBackend::Cln),
"strike" => Ok(LnBackend::Strike),
"lnbits" => Ok(LnBackend::LNbits),
"fakewallet" => Ok(LnBackend::FakeWallet),
"phoenixd" => Ok(LnBackend::Phoenixd),
"lnd" => Ok(LnBackend::Lnd),
_ => Err(format!("Unknown Lightning backend: {}", s)),
}
}
}

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct Ln {
pub ln_backend: LnBackend,
Expand Down Expand Up @@ -128,6 +144,18 @@ pub enum DatabaseEngine {
Redb,
}

impl std::str::FromStr for DatabaseEngine {
type Err = String;

fn from_str(s: &str) -> Result<Self, Self::Err> {
match s.to_lowercase().as_str() {
"sqlite" => Ok(DatabaseEngine::Sqlite),
"redb" => Ok(DatabaseEngine::Redb),
_ => Err(format!("Unknown database engine: {}", s)),
}
}
}

#[derive(Debug, Clone, Serialize, Deserialize, Default)]
pub struct Database {
pub engine: DatabaseEngine,
Expand Down
Loading

0 comments on commit 879e8c4

Please sign in to comment.