• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

payjoin / rust-payjoin / 21486039766

29 Jan 2026 04:23PM UTC coverage: 83.673% (+0.5%) from 83.203%
21486039766

Pull #1296

github

web-flow
Merge 741fb9cbc into 1b6cc38b5
Pull Request #1296: Add standalone metrics service to Payjoin-service

130 of 144 new or added lines in 7 files covered. (90.28%)

18 existing lines in 3 files now uncovered.

10224 of 12219 relevant lines covered (83.67%)

431.61 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/payjoin-service/src/config.rs
1
use std::path::{Path, PathBuf};
2
use std::time::Duration;
3

4
use config::{ConfigError, File};
5
use serde::Deserialize;
6
use tokio_listener::ListenerAddress;
7

8
#[derive(Debug, Clone, Deserialize)]
9
#[serde(default)]
10
pub struct Config {
11
    pub listener: ListenerAddress,
12
    pub storage_dir: PathBuf,
13
    #[serde(deserialize_with = "deserialize_duration_secs")]
14
    pub timeout: Duration,
15
    pub metrics_port: u16,
16
}
17

18
impl Default for Config {
19
    fn default() -> Self {
×
20
        Self {
×
21
            listener: "[::]:8080".parse().expect("valid default listener address"),
×
22
            storage_dir: PathBuf::from("./data"),
×
23
            timeout: Duration::from_secs(30),
×
NEW
24
            metrics_port: 9090,
×
25
        }
×
26
    }
×
27
}
28

UNCOV
29
fn deserialize_duration_secs<'de, D>(deserializer: D) -> Result<Duration, D::Error>
×
UNCOV
30
where
×
31
    D: serde::Deserializer<'de>,
×
32
{
33
    let secs = u64::deserialize(deserializer)?;
×
34
    Ok(Duration::from_secs(secs))
×
35
}
×
36

37
impl Config {
38
    pub fn from_file(path: &Path) -> Result<Self, ConfigError> {
×
UNCOV
39
        config::Config::builder()
×
40
            // Add from optional config file
41
            .add_source(File::from(path).required(false))
×
42
            // Add from the environment (with a prefix of PJ)
43
            // e.g. `PJ_PORT=9090` would set the `port`.
UNCOV
44
            .add_source(config::Environment::with_prefix("PJ"))
×
45
            .build()?
×
46
            .try_deserialize()
×
47
    }
×
48
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc