issue banner: avoid depending on proxmox crate for hostname
While this slightly duplicates code we just do not profit from the central, lazy static variant here, as that is only really useful in daemons to avoid doing frequent syscalls there. proxmox just pull in far to much (e.g., tokio) and duplicating that one line of simple code has no real maintenance cost, so just go for that and use the nix crate directly. Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
parent
3fa1b4b48c
commit
513d019ac3
@ -5,4 +5,4 @@ authors = ["Proxmox Support Team <support@proxmox.com>"]
|
||||
edition = "2018"
|
||||
|
||||
[dependencies]
|
||||
proxmox = { version = "0.11.5", default-features = false, features = [] }
|
||||
nix = "0.19.1"
|
||||
|
@ -2,10 +2,12 @@ use std::fmt::Write;
|
||||
use std::fs;
|
||||
use std::net::ToSocketAddrs;
|
||||
|
||||
use proxmox::tools;
|
||||
use nix::sys::utsname::uname;
|
||||
|
||||
fn main() {
|
||||
let nodename = tools::nodename();
|
||||
let uname = uname(); // save on stack to avoid to_owned() allocation below
|
||||
let nodename = uname.nodename().split('.').next().unwrap();
|
||||
|
||||
let addr = format!("{}:8007", nodename);
|
||||
|
||||
let mut banner = format!(
|
||||
|
Loading…
Reference in New Issue
Block a user