diff --git a/Cargo.lock b/Cargo.lock index fada742..4f177bd 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -328,6 +328,16 @@ dependencies = [ "slab", ] +[[package]] +name = "gethostname" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0176e0459c2e4a1fe232f984bca6890e681076abb9934f6cea7c326f3fc47818" +dependencies = [ + "libc", + "windows-targets 0.48.5", +] + [[package]] name = "gimli" version = "0.28.1" @@ -415,6 +425,7 @@ version = "0.1.0" dependencies = [ "failure", "futures", + "gethostname", "irc", "tokio", ] diff --git a/Cargo.toml b/Cargo.toml index e547ac9..5d22fa9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,4 +9,5 @@ edition = "2021" irc = "0.15.0" tokio = { version = "1.0.0", features = ["rt", "rt-multi-thread", "macros", "net", "time"] } futures = "0.3.0" -failure = "0.1.8" \ No newline at end of file +failure = "0.1.8" +gethostname = "*" \ No newline at end of file diff --git a/src/main.rs b/src/main.rs index ba53353..cdd2165 100644 --- a/src/main.rs +++ b/src/main.rs @@ -7,7 +7,7 @@ use std::process; async fn main() -> Result<(), failure::Error> { // We can also load the Config at runtime via Config::load("path/to/config.toml") let config = Config { - nickname: Some("irc-rpc".to_owned()), + nickname: Some(gethostname::gethostname().to_str().unwrap().to_owned()), server: Some("irc.ouch.chat".to_owned()), channels: vec!["#testing".to_owned()], ..Config::default()