make redis_ctrl use conf
This commit is contained in:
parent
c5654c7ae0
commit
133f301d1c
@ -7,8 +7,8 @@ laser_id = 0
|
||||
# Activate for more debug
|
||||
debug = "true"
|
||||
|
||||
# Redis URL as IP:port
|
||||
redis_url = "127.0.0.1"
|
||||
# Redis URL as redis://IP:port/
|
||||
redis_url = "redis://127.0.0.1:6379/"
|
||||
|
||||
# Either Helios or Etherdream
|
||||
dac_family = "Helios"
|
||||
|
@ -37,7 +37,7 @@ fn run_all() -> Result<(), Box<dyn std::error::Error>> {
|
||||
return Err(Box::new(LJError::ConfigFileMissing));
|
||||
};
|
||||
let config = Conf::new(&filename)?;
|
||||
let mut rs = RedisCtrl::new()?;
|
||||
let mut rs = RedisCtrl::new(&config.redis_url)?;
|
||||
|
||||
let running = Arc::new(AtomicBool::new(true));
|
||||
let r = running.clone();
|
||||
|
@ -49,8 +49,8 @@ pub struct RedisCtrl {
|
||||
}
|
||||
|
||||
impl RedisCtrl {
|
||||
pub fn new() -> Result<Self, Box<dyn std::error::Error>> {
|
||||
let client = Client::open("redis://127.0.0.1/")
|
||||
pub fn new(url: &str) -> Result<Self, Box<dyn std::error::Error>> {
|
||||
let client = Client::open(url)
|
||||
.map_err(LJError::RedisConnect)?;
|
||||
let connection = client.get_connection()
|
||||
.map_err(LJError::RedisConnect)?;
|
||||
|
Loading…
Reference in New Issue
Block a user