1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
//! Path resolution and spool-directory helpers.
//!
//! Provides the default spool path and endpoint normalization
//! used when constructing the storage layer.
//!
//! # Examples
//!
//! ```ignore
//! let dir = default_spool_dir();
//! assert!(dir.ends_with("traces/pending"));
//! ```
use PathBuf;
/// Resolve the directory where oracle traces are buffered
/// before upload to remote storage.
///
/// Reads `CODETETHER_ORACLE_SPOOL_DIR` if set; otherwise
/// falls back to `$HOME/.codetether/traces/pending`.
///
/// # Examples
///
/// ```ignore
/// std::env::set_var("CODETETHER_ORACLE_SPOOL_DIR", "/tmp/spool");
/// assert_eq!(default_spool_dir(), PathBuf::from("/tmp/spool"));
/// ```
/// Ensure an endpoint string starts with a scheme.
///
/// Returns the input unchanged when it already begins with
/// `http://` or `https://`. Otherwise prepends `https://` when
/// `secure` is true, or `http://` when false.
///
/// # Examples
///
/// ```ignore
/// assert_eq!(normalize_endpoint("minio:9000", false), "http://minio:9000");
/// assert_eq!(normalize_endpoint("https://s3.aws", true), "https://s3.aws");
/// ```