Replace custom logging with tracing crate and RUST_LOG env var
- Remove custom logging module and init_logging function - Update main.rs to use tracing_subscriber with EnvFilter - Remove log_level from global config structure - Update documentation and tests to use RUST_LOG - Format long lines in config.rs and test files for better readability
This commit is contained in:
parent
50a4d9bc75
commit
55fe47b172
15 changed files with 787 additions and 459 deletions
|
|
@ -7,8 +7,22 @@ pub fn generate_test_certificates_for_host(temp_dir: &Path, hostname: &str) {
|
|||
|
||||
// Generate self-signed certificate for testing
|
||||
// This is a simplified version - in production, use proper certificates
|
||||
std::fs::write(&cert_path, format!("-----BEGIN CERTIFICATE-----\nTest cert for {}\n-----END CERTIFICATE-----\n", hostname)).unwrap();
|
||||
std::fs::write(&key_path, format!("-----BEGIN PRIVATE KEY-----\nTest key for {}\n-----END PRIVATE KEY-----\n", hostname)).unwrap();
|
||||
std::fs::write(
|
||||
&cert_path,
|
||||
format!(
|
||||
"-----BEGIN CERTIFICATE-----\nTest cert for {}\n-----END CERTIFICATE-----\n",
|
||||
hostname
|
||||
),
|
||||
)
|
||||
.unwrap();
|
||||
std::fs::write(
|
||||
&key_path,
|
||||
format!(
|
||||
"-----BEGIN PRIVATE KEY-----\nTest key for {}\n-----END PRIVATE KEY-----\n",
|
||||
hostname
|
||||
),
|
||||
)
|
||||
.unwrap();
|
||||
}
|
||||
use tempfile::TempDir;
|
||||
|
||||
|
|
@ -42,12 +56,19 @@ fn generate_test_certificates(temp_dir: &Path) {
|
|||
// Use openssl to generate a test certificate
|
||||
let output = Command::new("openssl")
|
||||
.args(&[
|
||||
"req", "-x509", "-newkey", "rsa:2048",
|
||||
"-keyout", &key_path.to_string_lossy(),
|
||||
"-out", &cert_path.to_string_lossy(),
|
||||
"-days", "1",
|
||||
"req",
|
||||
"-x509",
|
||||
"-newkey",
|
||||
"rsa:2048",
|
||||
"-keyout",
|
||||
&key_path.to_string_lossy(),
|
||||
"-out",
|
||||
&cert_path.to_string_lossy(),
|
||||
"-days",
|
||||
"1",
|
||||
"-nodes",
|
||||
"-subj", "/CN=localhost"
|
||||
"-subj",
|
||||
"/CN=localhost",
|
||||
])
|
||||
.output();
|
||||
|
||||
|
|
@ -60,8 +81,3 @@ fn generate_test_certificates(temp_dir: &Path) {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue