Skip to content

Open source, composable payments platform | PCI compliant | SaaS and Self-host options | Enables connectivity to multiple payment, payout, fraud, vault and tokenization providers | Uplifts authorization with intelligent routing and revenue recovery | Reduce payment processing costs with cost observability | Reduces payment ops with reconciliation

538 B
Raw Blame
use std::string::String;

use serde::Deserialize;
use toml::Value;

#[derive(Deserialize)]
pub struct InputData {
    username: String,
    password: String,
    dbname: String,
    host: String,
    port: u16,
}

impl InputData {
    pub fn read(db_table: &Value) -> Result<Self, toml::de::Error> {
        db_table.clone().try_into()
    }

    pub fn postgres_url(&self) -> String {
        format!(
            "postgres://{}:{}@{}:{}/{}",
            self.username, self.password, self.host, self.port, self.dbname
        )
    }
}