Overview
| Comment: | reorder uses, properly react to errors with hostname, |
|---|---|
| Downloads: | Tarball | ZIP archive | SQL archive |
| Timelines: | family | ancestors | descendants | both | trunk |
| Files: | files | file ages | folders |
| SHA3-256: |
713c1e7fb297913177e1f676f5c2773d |
| User & Date: | arcade on 2026-07-31 15:12:47.940 |
| Other Links: | manifest | tags |
Context
|
2026-07-31
| ||
| 15:20 | propagate error from async check-in: cc376760fc user: arcade tags: trunk | |
| 15:12 | reorder uses, properly react to errors with hostname, check-in: 713c1e7fb2 user: arcade tags: trunk | |
| 15:11 | make html tags check case insensitive check-in: bf99298edf user: arcade tags: trunk | |
Changes
Modified src/lib.rs
from [9dab3246bf]
to [2d1a8f5193].
|
| | > > > > > > > > > > < < < < < < | 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 |
pub mod mail;
mod telegram;
pub mod utils;
// As we are not actually exporting this lib there would be no local Error's for
// now, everything will be just .stack()?'ed and propagated like in real bin
// The lib here is just to separate all tests from main code into tests/
use crate::mail::MailServer;
use std::{
io::Cursor,
os::unix::fs::PermissionsExt,
path::Path,
};
use just_getopt::{
OptFlags,
OptSpecs,
OptValue,
};
use smol::{
fs::metadata,
};
use stacked_errors::{
Result,
StackableErr,
bail,
};
/// Actual main function running async with Error propagation support
pub async fn async_main () -> Result<()> {
let specs = OptSpecs::new()
.option("help", "h", OptValue::None)
.option("help", "help", OptValue::None)
.option("config", "c", OptValue::Required)
.option("config", "config", OptValue::Required)
|
| ︙ | ︙ | |||
62 63 64 65 66 67 68 |
}
let settings: config::Config = config::Config::builder()
.set_default("api_gateway", "https://api.telegram.org").stack()?
.set_default("fields", vec!["date", "from", "subject"]).stack()?
.set_default("hostname", "smtp.2.tg").stack()?
.set_default("listen_on", "0.0.0.0:1025").stack()?
.set_default("unknown", "relay").stack()?
| | > > | 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 |
}
let settings: config::Config = config::Config::builder()
.set_default("api_gateway", "https://api.telegram.org").stack()?
.set_default("fields", vec!["date", "from", "subject"]).stack()?
.set_default("hostname", "smtp.2.tg").stack()?
.set_default("listen_on", "0.0.0.0:1025").stack()?
.set_default("unknown", "relay").stack()?
.set_default("domains", vec!["localhost",
hostname::get().expect("Failed to get current hostname")
.to_str().expect("Can't convert hostname to string, bad UTF-8?")]).stack()?
.add_source(config::File::from(config_file))
.build()
.with_context(|| format!("[{config_file:?}] there was an error reading config\n\
\tplease consult \"smtp2tg.toml.example\" for details"))?;
let listen_on = settings.get_string("listen_on").stack()?;
let server_name = settings.get_string("hostname").stack()?;
|
| ︙ | ︙ |