diff --git a/copyme.Settings.toml b/copyme.Settings.toml index 21944b6..24b446c 100644 --- a/copyme.Settings.toml +++ b/copyme.Settings.toml @@ -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" diff --git a/src/main.rs b/src/main.rs index 2bef1f4..d324b2d 100644 --- a/src/main.rs +++ b/src/main.rs @@ -37,7 +37,7 @@ fn run_all() -> Result<(), Box> { 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(); diff --git a/src/redis_ctrl.rs b/src/redis_ctrl.rs index 4b123ca..e8971cc 100644 --- a/src/redis_ctrl.rs +++ b/src/redis_ctrl.rs @@ -49,8 +49,8 @@ pub struct RedisCtrl { } impl RedisCtrl { - pub fn new() -> Result> { - let client = Client::open("redis://127.0.0.1/") + pub fn new(url: &str) -> Result> { + let client = Client::open(url) .map_err(LJError::RedisConnect)?; let connection = client.get_connection() .map_err(LJError::RedisConnect)?;