use std::{env, error, net::IpAddr}; use log::debug; // pub(super) const PASSWORD: &str = "mypass"; // pub(super) fn get_conn_addr() -> Result> { let port = env::var("REDIS_TCP_PORT")?; debug!("REDIS_TCP_PORT {}", port); let ip_addr = "127.0.0.1".parse::()?; let port = port.parse::()?; Ok(format!("redis://:{}@{}:{}", PASSWORD, ip_addr, port)) } pub(super) fn get_conn_addr_without_password() -> Result> { let port = env::var("REDIS_TCP_PORT")?; debug!("REDIS_TCP_PORT {}", port); let ip_addr = "127.0.0.1".parse::()?; let port = port.parse::()?; Ok(format!("redis://{}:{}", ip_addr, port)) } pub(super) fn init_logger() { let _ = env_logger::builder().is_test(true).try_init(); }